Not logged in, Join Here! or Log In Below:  
News Articles Search    

 Home / General Programming / MinGW & OpeGL linkage problem. Underscores trouble. Account Manager
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

May 23, 2005, 10:59 AM

I find it almost embarassing that I have to ask this:

Im moving a VC++ application using OpenGL to Eclipse/MinGW. Everything is fine for calls from the main application to OpenGL.

Now I have a static library (.a) that calls OpenGL. Obviously these calls get resolved by the linker only when the library is linked against the main application along with libopengl32.a.

But this doesn't work, the linker complains about undefined references to all the OpenGL calls that are made from the static library. The functions in the main application link fine.

I tracked the problem down to the fact that the first leading underscore gets removed. Depending on how I declare them in the header file, the functions that the library uses look like __imp__glBindTexture@8 or _glBindTexture@8.

But the linker looks for _imp__glBindTexture@8 or glBindTexture@8 for all the calls from the static library, and looks for the proper names for all the calls from the main application.

What's up here ? Surely I'm missing something obvious ?


May 23, 2005, 11:58 AM

Too dumb, ignore that. I solved it. Sometimes it helps to write the problem down, doesn't it ?

This thread contains 2 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.