Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

soil linker errors

  • You cannot reply to this topic
7 replies to this topic

#1 DasBruce   Members   -  Reputation: 104

Like
0Likes
Like

Posted 04 November 2011 - 03:09 AM

I'm trying to load textures with soil and my code is compiling fine but throwing errors when linking.

C:\SourceCode\Libraries\SOIL\lib\libSOIL.a(SOIL.o):SOIL.c|| undefined reference to `glGetString@4'|
C:\SourceCode\Libraries\SOIL\lib\libSOIL.a(SOIL.o):SOIL.c|| undefined reference to `glGetString@4'|
C:\SourceCode\Libraries\SOIL\lib\libSOIL.a(SOIL.o):SOIL.c|| undefined reference to `glGetString@4'|
C:\SourceCode\Libraries\SOIL\lib\libSOIL.a(SOIL.o):SOIL.c|| undefined reference to `glGetString@4'|
C:\SourceCode\Libraries\SOIL\lib\libSOIL.a(SOIL.o):SOIL.c|| undefined reference to `glGetString@4'|
C:\SourceCode\Libraries\SOIL\lib\libSOIL.a(SOIL.o):SOIL.c|| more undefined references to `glGetString@4' follow|
C:\SourceCode\Libraries\SOIL\lib\libSOIL.a(SOIL.o):SOIL.c|| undefined reference to `wglGetProcAddress@4'|
||=== Build finished: 7 errors, 0 warnings ===|

I'm using CodeBlocks 10 with gcc on W7. I tried rebuilding the soil.a but it made no difference. What libraries should I link with to make soil work?

Sponsor:

#2 Caste   Moderators   -  Reputation: 944

Like
0Likes
Like

Posted 04 November 2011 - 03:55 AM

Are you linking to -lopengl32 ? Would be nice if you could tell us all the libraries you link to.

#3 DasBruce   Members   -  Reputation: 104

Like
0Likes
Like

Posted 04 November 2011 - 06:21 AM

Ah right. Not sure how many need to be there still, the base code gets reused a lot, but this is all of them.

Posted Image

#4 Caste   Moderators   -  Reputation: 944

Like
1Likes
Like

Posted 04 November 2011 - 10:32 PM

That seemed really strange to me, as you are linking against all the windows and opengl related libraries, so I tried it in C::B myself and got the same errors.

After struggling with it a while I found the solution: you have to link to SOIL before opengl32!

I didn't know that the order of the libraries matters at all, but that seems to be the proof :) Hope that works for you too!

#5 DasBruce   Members   -  Reputation: 104

Like
0Likes
Like

Posted 06 November 2011 - 10:11 PM

Awesome, that fixed it. Is there a rule for which order I should link in or is it a bit hit and miss?

#6 plusnoir   Members   -  Reputation: 102

Like
0Likes
Like

Posted 24 November 2011 - 06:03 AM

Hi folks,

I am using Code::BLocks, too. But actually I don't have a clue how to link SOIL.
I downloaded SOIL here. But still no clue how to link it.

Would be thankfull for any advice.

Greets

plusnoir

#7 Caste   Moderators   -  Reputation: 944

Like
0Likes
Like

Posted 04 December 2011 - 11:57 PM

I am using Code::BLocks, too. But actually I don't have a clue how to link SOIL.


A general answer can be found here: http://www.learncpp.com/cpp-tutorial/a3-using-libraries-with-codeblocks/
Whatever IDE you use, always be sure to know how to add libraries and include directories as this is a crucial skill in programming!

#8 Bobby Oster   Members   -  Reputation: 102

Like
0Likes
Like

Posted 23 April 2013 - 02:56 PM

After struggling with it a while I found the solution: you have to link to SOIL before opengl32!

 

Very helpful - I would have messed around quite a while before doing this.  Worked for me too.







PARTNERS