   [SOLVED] Undefined Reference Error... Even With Correct Static Libraries Linked?!
  Hi,I've relatively recently started using Code::Blocks 8.02 with the MinGW compiler for a project using OpenGL with GLee 5.4.  I'm an experienced C/C++ programmer, but I've never programmed static libraries before my current project.  I have three custom projects: a main project (my game) which builds as an executable, a simple targa file loader (and saver in the future) project which builds as a static library (libtarga.a), and a common functions project that builds as a static library (libcommon.a).  The targa library uses the common library, and the main executable uses both libraries.So when I build each of my two static libraries, they succeed with no errors or warnings.  But when I build my main project, I get a "undefined reference to _glPixelStorei@8" linker error.  The error shows that the line of code where it's referenced is in my .cpp file in the targa static library project (and libtarga.a was built without any errors).  Normally when I receive an error like this, I immediately think I've forgotten to link a library file (the .a files in the case of Code::Blocks).  This would also make sense since I previously had my targa and common projects in one project with my main project (I decided to split them primarily to enforce future code portability).  The then single executable-building project was built without this or any other errors, and ran without error.  So I added the OpenGL and GLee static libraries to both my main and targa library projects which use them, but the error persisted.  Figuring that maybe one of the other static libraries linked with my main project was needed for some reason (since I didn't get this error when it was one project), I then linked the GLU library (even though the targa library doesn't reference anything from glu), and later also linked every other static library to the targa project that is also linked to my main project so that they both were linked to the same exact libraries.  I made sure my targa and common libraries were in fact linked to the main project, and that the common library was linked to the targa project.  But the error still persists.Any ideas (other than revert to a single project, which I will do if I can't figure this out)?  Thanks!Edit: I'm presently coding on a Win XP Pro SP3 machine with 2 GB RAM and plenty of hard disk space.  My intended platforms are Windows, Mac and Linux.[Edited by - BrianMJC on May 19, 2009 8:09:23 PM]
  Try changing the order of linking?(i.e. are OpenGL / GLee linked before your own statics?)   ;Quote:Original post by sprite_houndTry changing the order of linking?(i.e. are OpenGL / GLee linked before your own statics?)Lol, yes, that was the problem, I just reversed their order and now it's fine, thanks!