Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / September 2004



Tip: Looking for answers? Try searching our database.

compiling sdl (fink) + opengl (including glut)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michal Adamczak - 25 Sep 2004 17:00 GMT
i am trying to compile an application that i onced wrote for linux.
it uses sdl and opengl (including glut).
i installed sdl libraries and headers using fink.
also added '-objc' option to g++ (it helped with one problem).
however during consolidation i got following error (i provide all make
output):

g++ -c  space.cc -I/sw/include/SDL/ -I/usr/X11R6/include/
g++ -c  draw.cc -I/sw/include/SDL/ -I/usr/X11R6/include/
g++ -c  spacedraw.cc -I/sw/include/SDL/ -I/usr/X11R6/include/
g++ -c  gravspace.cc -I/sw/include/SDL/ -I/usr/X11R6/include/
g++ main.cc -o grav space.o gravspace.o spacedraw.o draw.o
-L/usr/X11R6/lib/ -L/sw/lib/ -lGL -lGLU -lm -lSDL -lpthread -lobjc
-I/sw/include/SDL/ -I/usr/X11R6/include/
ld: draw.o illegal reference to symbol: _XCloseDisplay defined in
indirectly referenced dynamic library /usr/X11R6/lib/libX11.6.dylib
make: *** [grav] Error 1

tia

Signature

Michal Adamczak
pokryfka@druid.if.uj.edu.pl

Eric Albert - 25 Sep 2004 23:05 GMT
> i am trying to compile an application that i onced wrote for linux.
> it uses sdl and opengl (including glut).
[quoted text clipped - 13 lines]
> indirectly referenced dynamic library /usr/X11R6/lib/libX11.6.dylib
> make: *** [grav] Error 1

Add -lX11 to your link line.

Hope this helps,
Eric

Signature

Eric Albert         ejalbert@cs.stanford.edu
http://outofcheese.org/

Michal Adamczak - 26 Sep 2004 12:28 GMT
>> g++ main.cc -o grav space.o gravspace.o spacedraw.o draw.o
>> -L/usr/X11R6/lib/ -L/sw/lib/ -lGL -lGLU -lm -lSDL -lpthread -lobjc
[quoted text clipped - 7 lines]
> Hope this helps,
> Eric

thanks, i guess it helped but still there's something wrong :(
is there anything else  should take care of?

g++ main.cc -o grav space.o gravspace.o spacedraw.o draw.o
-L/usr/X11R6/lib/ -L/sw/lib/ -lGL -lGLU -lm -lSDL -lpthread -lobjc -lX11
-I/sw/include/SDL/ -I/usr/X11R6/include/
ld: Undefined symbols:
_main
make: *** [grav] Error 1

Signature

Michal Adamczak
pokryfka@druid.if.uj.edu.pl

Eric Albert - 26 Sep 2004 18:32 GMT
> >> g++ main.cc -o grav space.o gravspace.o spacedraw.o draw.o
> >> -L/usr/X11R6/lib/ -L/sw/lib/ -lGL -lGLU -lm -lSDL -lpthread -lobjc
[quoted text clipped - 17 lines]
> _main
> make: *** [grav] Error 1

I'd guess that main is having its name mangled as a C++ function.  Try
changing this:
   int main(...)
to this:
   extern "C" int main(...)

Hope this helps,
Eric

Signature

Eric Albert         ejalbert@cs.stanford.edu
http://outofcheese.org/

Gabriele Greco - 27 Sep 2004 11:48 GMT
hanks, i guess it helped but still there's something wrong :(
>>is there anything else  should take care of?
>>
[quoted text clipped - 4 lines]
>>_main
>>make: *** [grav] Error 1

Add to the link line:
 -lSDLmain

And be sure to include "SDL.h" in main.cc.

Anyway IMHO you should use the SDL framework available from libSDL.org,
you can use it also from the command line adding to your link line:

-F~/Library/Frameworks/ -framework SDL

The problem with fink SDL is that it may require X11 and it needs the
libraries placed in the same place they are in your system, the problem
with selfbuilt SDL is that it doesn't work with OSX version below the
one of your system and you will need to place the libraries with an
installer in the same location where they are located in your system.

Bye,
 Gabry
Michal Adamczak - 28 Sep 2004 17:53 GMT
> Add to the link line:
>   -lSDLmain
>
> And be sure to include "SDL.h" in main.cc.

unfortunatelly this didnt help

i shall look up the code and fix it a bit so it compiles with aqua
however i'd like to be able to compile it on linux as well
and i'm worried that i'll have to use preprocesor in order to do that
and write some code separately for each of them

Signature

Michal Adamczak
pokryfka@druid.if.uj.edu.pl

Gabriele Greco - 28 Sep 2004 18:04 GMT
> i shall look up the code and fix it a bit so it compiles with aqua
> however i'd like to be able to compile it on linux as well
> and i'm worried that i'll have to use preprocesor in order to do that
> and write some code separately for each of them

You don't need to do that.

Just compile yourself SDL or link against the SDL framework you find on
libsdl.org, I'm quite sure the problem is in your makefile or in your
SDL version.

I've ported a commercial game to Mac and Linux from w32 and the only...

#ifdef __APPLE__

...i've to add to the sources is to force CTRL+left button to do the
same of right button (I've to do it since the game need a two button
mouse :) )

Other than that I've two different makefiles, the osx one build the .app
structure and links with the correct libraries, no differences in
sources (370.000 lines).

Bye,
 Gabry

PS: The demo version will be out the next week
Michal Adamczak - 27 Sep 2004 11:56 GMT
>> g++ main.cc -o grav space.o gravspace.o spacedraw.o draw.o
>> -L/usr/X11R6/lib/ -L/sw/lib/ -lGL -lGLU -lm -lSDL -lpthread -lobjc -lX11
[quoted text clipped - 8 lines]
> to this:
>     extern "C" int main(...)

nope :(
the error message is still the same
Signature

Michal Adamczak
pokryfka@druid.if.uj.edu.pl

Benjamin Riefenstahl - 27 Sep 2004 17:50 GMT
Hi Michal,

> g++ main.cc -o grav space.o gravspace.o spacedraw.o draw.o
> -L/usr/X11R6/lib/ -L/sw/lib/ -lGL -lGLU -lm -lSDL -lpthread -lobjc
> -I/sw/include/SDL/ -I/usr/X11R6/include/
> ld: draw.o illegal reference to symbol: _XCloseDisplay defined in
> indirectly referenced dynamic library /usr/X11R6/lib/libX11.6.dylib
> make: *** [grav] Error 1

I once talked with the SDL developers about X11 vs. Aqua.  They were
pretty steadfast that they didn't want to support an X11-version of
SDL on Mac OS X, only the Aqua version.

So this reference to XCloseDisplay() probably comes from the
application code which is still trying to call X11 but should be
ported to Aqua, before this works with SDL.

You also want to remove -I/usr/X11R6/include/ and fix everything that
this breaks to make sure no X11-specific code remains in the app.

benny
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.