compiling sdl (fink) + opengl (including glut)

compiling sdl (fink) + opengl (including glut)

Post by Michal Ada » Mon, 27 Sep 2004 01:00:23


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

--
Michal Adamczak
XXXX@XXXXX.COM
 
 
 

compiling sdl (fink) + opengl (including glut)

Post by Eric Alber » Mon, 27 Sep 2004 07:05:44

In article < XXXX@XXXXX.COM >,



Add -lX11 to your link line.

Hope this helps,
Eric

--
Eric Albert XXXX@XXXXX.COM
http://www.yqcomputer.com/

 
 
 

compiling sdl (fink) + opengl (including glut)

Post by Michal Ada » Mon, 27 Sep 2004 20:28:13

>> g++ main.cc -o grav space.o gravspace.o spacedraw.o draw.o

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

--
Michal Adamczak
XXXX@XXXXX.COM
 
 
 

compiling sdl (fink) + opengl (including glut)

Post by Eric Alber » Tue, 28 Sep 2004 02:32:59

In article < XXXX@XXXXX.COM >,



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

--
Eric Albert XXXX@XXXXX.COM
http://www.yqcomputer.com/
 
 
 

compiling sdl (fink) + opengl (including glut)

Post by Gabriele G » Tue, 28 Sep 2004 19:48:34


hanks, i guess it helped but still there's something wrong :(

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
 
 
 

compiling sdl (fink) + opengl (including glut)

Post by Michal Ada » Tue, 28 Sep 2004 19:56:36

>> g++ main.cc -o grav space.o gravspace.o spacedraw.o draw.o

nope :(
the error message is still the same
--
Michal Adamczak
XXXX@XXXXX.COM
 
 
 

compiling sdl (fink) + opengl (including glut)

Post by Benjamin R » Wed, 29 Sep 2004 01:50:18

Hi Michal,


Michal Adamczak writes:

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
 
 
 

compiling sdl (fink) + opengl (including glut)

Post by Michal Ada » Thu, 30 Sep 2004 01:53:09

> Add to the link line:

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

--
Michal Adamczak
XXXX@XXXXX.COM
 
 
 

compiling sdl (fink) + opengl (including glut)

Post by Gabriele G » Thu, 30 Sep 2004 02:04:49


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