COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 07-28-2011, 02:55 PM   #1
turion
Human being with feelings
 
Join Date: Jul 2011
Posts: 9
Default Compile problems

Hi!

I'm trying to compile Ninjam 0.01a on Kubuntu 11.04.
I'm getting the following error during compilation:

../njclient.cpp:2058:17: error: cast from ‘WDL_HeapBuf*’ to ‘int’ loses precision

What to do now? Compile with some warnings switched off?
turion is offline   Reply With Quote
Old 09-06-2011, 04:55 PM   #2
deif
Human being with feelings
 
Join Date: Sep 2011
Posts: 1
Default

I just registered to answer you.

The error mentioned is an error, and not just a warning. So it can't just be switched off.
The problem is in the code itself.


I've looked at the code and found some lines like this:
if ((int)*bufs != 0 && (int)*bufs != -1)
...
as if pointers could always fit inside an integer.
That isn't true, as some systems are 64bit and thus pointers are 64bit in size, while ints could not be.

Instead of that nonsense it could be rewritten like this:
if (*bufs != (WDL_HeapBuf*)0 && *bufs != (WDL_HeapBuf*)-1)

That is, instead to cast the pointer to an integer to compare them, cast the numeric constant to a pointer.


That has to be done in each line of the code that has that type of error. Just find the type of the pointer and cast the int to that type.



Also there are some warnings regarding the conversion from strings constants to 'char*'.
That is caused because string constants are 'const char*' and the code converts them implicitly to 'char*'.
The solution is to put '(char*)' in front of the literal string.

I hadn't the time to correct the warnings myself.


Correcting the errors above do make the app compile, but there's a bug with the client sending the wrong password/whatever (maybe the bug is related with 64bit systems too).
I've compared the network packets from a Linux client and a Windows client on the same machine (with Wine) and they do differ. The Windows clients connects OK while the Linux one doesn't.
But I haven't looked yet at the cause.


I hope any developer takes the time to do the necessary changes.
BTW, for the devs: if you had chosen Qt as the library for the UI you could have made a multiplatform graphical client, for Mac, Linux, Windows and even mobile phones.
deif is offline   Reply With Quote
Old 09-07-2011, 12:38 AM   #3
pljones
Human being with feelings
 
pljones's Avatar
 
Join Date: Aug 2007
Location: London, UK
Posts: 767
Default

Qt was pretty much linux-only when the app was last updated, I think. Also, the 32/64 issue didn't exist back then (but it is very bad coding style...).

Is there any chance you can post a patch if you've got it working?
__________________
Quote:
Originally Posted by Tony Williams
...Playing fast around the drums is one thing. But to play with people for others, to listen to, that's something else. That's a whole other world.
pljones is online now   Reply With Quote
Old 12-21-2011, 05:05 AM   #4
turion
Human being with feelings
 
Join Date: Jul 2011
Posts: 9
Default

Hi, sorry I didn't respond, I didn't have notifications on.
I'm not very good in C++, my fluent mother tongue is Python.
The issue seems to be fixed in wahjam (probably the way you mentioned?), so I don't really bother anymore. Thanks for the advice! I will post this issue in the archlinux package of ninjam.
turion is offline   Reply With Quote
Old 10-26-2012, 04:22 AM   #5
i72peesj
Human being with feelings
 
Join Date: Oct 2012
Posts: 1
Default Solved

edit Makefile at /ninjam/cursesclient and change first line with:

"CFLAGS = $(OPTFLAGS) -s "

by

"CFLAGS = $(OPTFLAGS) -s -fpermissive"


do make and that's all.
i72peesj is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:38 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.