OpenGL and GLX

Zbynek Winkler zwin@users.sourceforge.net
Thu Nov 13 09:11:00 GMT 2003


Harold L Hunt II wrote:

>
> Zbynek Winkler wrote:
>
>> Alexander Gottwald wrote:
>>
>>> On Wed, 12 Nov 2003, Zbynek Winkler wrote:
>>>
>>>> It seems the linker is not using the libraries at all :-(.
>>>> Zbynek
>>>>
>>>> $ g++ -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lGL -Wl,-t 
>>>> glxsample.cpp -o glxsample
>>>>   
>>>
>>>
>>> reorder the arguments:
>>>
>>> $ g++ glxsample.cpp -I/usr/X11R6/include -L/usr/X11R6/lib -lX11 -lGL 
>>> -o glxsample
>>>  
>>>
>> Thanks. That actually works! Would you have a hint as to why the 
>> order is important?
>> Also would you know how to fix this command that shows the same 
>> symptoms?
>
>
> Because on Cygwin the linker looks at each object file and library in 
> sequential order and compiles a list of undefined symbols.  It only 
> attempts to resolve these symbols in objects and libraries that have 
> not been processed yet.  Any symbols not required by previous objects 
> or libraries are not preserved for later objects/libraries to use.
>
> Thus, if -lGL uses -lX11 symbols, then you must first include -lGL so 
> that it sets up a list of unresolved symbols that will be resolved 
> when -lX11 is processed next.
>
> Does that make sense?

I guess it does. But guys thanks, it helped to solve my problem. The 
problem was twofold. First I was including wrong header files (in the 
bigger project) and then there was the sequencing problem when linking. 
When linking against libGL one has to make sure that /usr/X11R6/include 
headers are used. There was no include path set and the compiler (after 
I removed /usr/include/GL) was using /usr/include/w32api/GL which I 
didn't even know about.

Zbynek

-- 
<zw at matfyz.cz>
http://zw.matfyz.cz/     http://robotika.cz/
Faculty of Mathematics and Physics, Charles University, Prague, Czech Republic




More information about the Cygwin-xfree mailing list