help-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble compiling command-line application


From: Fred Kiefer
Subject: Re: Trouble compiling command-line application
Date: Tue, 24 Feb 2004 18:53:34 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030821

zauhar wrote:
I have been working with Cocoa for a while, but this is my first experience with GNUstep.

I am starting out by trying to port a fairly small command-line application from OS X to Redhat Linux 3.2.2-5 (gcc 3.2.2)

I installed the latest distributions of gnustep base (gnustep-base-1.9.0.tar), backend (gnustep-back-0.9.1.tar) and make (gnustep-make-1.9.0.tar), and I am able to build some small test apps I found in the docs. However, when I try to build my own application, I get this when compiling main.m :

<...various warnings...>
main.m:285: warning: assignment discards qualifiers from pointer target type main.m:311: warning: passing arg 1 of `initWithFlatFile:andMolFile:' discards qualifiers from pointer target type main.m:311: warning: passing arg 2 of `initWithFlatFile:andMolFile:' discards qualifiers from pointer target type main.m:363: warning: assignment discards qualifiers from pointer target type
/usr/include/bits/socket.h: At top level:
/usr/include/bits/socket.h:279: redefinition of `v'
/usr/include/bits/socket.h:279: `v' previously declared here
make[1]: *** [shared_obj/main.o] Error 1
make: *** [rayTrace.all.app.variables] Error 2

This application compiles and works fine under OS X. Thinking there might be something funky with #import under linux, I wrapped my header files in #ifndef's and switched to using #include. Same behavior.

I also started playing with the includes - in particular, I went through and changed all #include <Foundation/Foundation.h> to <Foundation/NSObject.h> which is adequate for some of my classes. This results in the same sort of error, but now the final messages are

main.m:363: warning: `NSString' does not respond to `cString'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/objc/sarray.h: At top level: /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/objc/sarray.h:235: redefinition of `v' /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/objc/sarray.h:235: `v' previously declared here
make[1]: *** [shared_obj/main.o] Error 1
make: *** [rayTrace.all.app.variables] Error 2

Note same crap about "redefinition of `v'", but now in a different file. Something really spurious is going on.


First of all, you should never regard any messages from a compiler as "crap", they mostly are valuable hints on problematic lines of code. As you are using different version of the gcc on MacOSX and Red Had their opinion on problematic code may also be different. It is hard to tell, what is going wrong in your case without a look at the actual code. The problem surely isn't in the header files, where it gets reported. I would rather expect it to be in your main.m file. Strange enough it seams to get reported on the end of the first inline function. If your main.m file in not to big, it would help, if you send it along in the next mail. The new warning you did get is of course due to the fact that you no longer included NSString.h.

Cheers
Fred





reply via email to

[Prev in Thread] Current Thread [Next in Thread]