OpenGL and GLX

Harold L Hunt II huntharo@msu.edu
Wed Nov 12 18:33:00 GMT 2003



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?

Harold



More information about the Cygwin-xfree mailing list