www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Linking OpenGL and SDL OSX 10.4

reply Johan Granberg <lijat.meREM OVEgmail.com> writes:
I have tried to create an application using SDL and OpenGL under OSX and 
encountered difficulties when I try to link it.

Fairy:~/Desktop/spacesim johan$ make
gdc -I/usr/include/d/4.0.1/ build/base/main.o build/base/config.o 
build/base/window.o build/base/interfaces.o build/base/file.o 
build/base/game.o build/base/spacesim.o -o build/spacesim -Llib 
-framework OpenGL -framework SDL
/usr/bin/ld: Undefined symbols:
__ModuleInfo_1c2gl2gl
__ModuleInfo_1c2gl3glu
__ModuleInfo_1c3sdl3sdl
collect2: ld returned 1 exit status
make: *** [build/spacesim] Error 1
Fairy:~/Desktop/spacesim johan$

How do I resolve these symbols. I'm using the headers fund on dsource.

thanks in advance
/Johan

ps. if you need more info just tell me what you need to know
Mar 24 2006
parent reply Frank Benoit <frank nix.de> writes:
Seems to be a bug. If a module has only C-declarations and no actions in
it, the compiler does not generate the ModuleInfo symbol.
For work around you can add a

unittest{}

into each such module.
Mar 24 2006
parent reply Johan Granberg <lijat.meREM OVEgmail.com> writes:
Frank Benoit wrote:
 Seems to be a bug. If a module has only C-declarations and no actions in
 it, the compiler does not generate the ModuleInfo symbol.
 For work around you can add a
 
 unittest{}
 
 into each such module.
Ok you got me confused. I had asumed you used the files as c headers and therfor did not compiled and linked them. I tried to compile and link them to but that resulted in multiple definitions of wath i belive to bee every public symbol in opengl. what am i suposed to do to get the bindings working? I used these bindings but if there are others i can easily use them instead http://www.dsource.org/projects/bindings/wiki/OpenGraphicsLibrary
Mar 26 2006
parent reply James Pelcis <jpelcis gmail.com> writes:
Hello.  Although I made those bindings, it doesn't surprise me that they 
can't be used.  The problem is that I don't own a Mac.

As I understand things, the headers still need to be compiled and 
linked.  If you don't do that, you'll be calling a non-existent 
function.  The major caveat is that _glextern.d should NOT be linked in 
or GLUT fonts might not work (on some operating system, at least).

Further than that, I can't really help other than to apply whatever 
fixes are needed.

Johan Granberg wrote:
 Frank Benoit wrote:
 Seems to be a bug. If a module has only C-declarations and no actions in
 it, the compiler does not generate the ModuleInfo symbol.
 For work around you can add a

 unittest{}

 into each such module.
Ok you got me confused. I had asumed you used the files as c headers and therfor did not compiled and linked them. I tried to compile and link them to but that resulted in multiple definitions of wath i belive to bee every public symbol in opengl. what am i suposed to do to get the bindings working? I used these bindings but if there are others i can easily use them instead http://www.dsource.org/projects/bindings/wiki/OpenGraphicsLibrary
Mar 26 2006
parent Johan Granberg <lijat.meREM OVEgmail.com> writes:
James Pelcis wrote:
 Hello.  Although I made those bindings, it doesn't surprise me that they 
 can't be used.  The problem is that I don't own a Mac.
 
 As I understand things, the headers still need to be compiled and 
 linked.  If you don't do that, you'll be calling a non-existent 
 function.  The major caveat is that _glextern.d should NOT be linked in 
 or GLUT fonts might not work (on some operating system, at least).
 
 Further than that, I can't really help other than to apply whatever 
 fixes are needed.
If anyone is intrested I solved the problem by using the opengl bindings from the glfw project and as a result I'm now using glfw instead of sdl.
Mar 30 2006