User forums > Help

Undefined References when compiling/linking an openGLaopengl


I just downloaded the new version of c::b and it looks like it is good but I ran into one problem i had not found before in codeblocks or devc++ (all other copmpilers: vc98, vc 2003, borland 5.5... have this problem). I get the error:

undefined reference to '[opengl function]@[number]'

for example: undefined reference to 'glOrtho@48'

and beta 3 compiled the same code with the same minGW install. one more thing: when i was using glut, vc2003 worked! I don't have a clue what is going on, if anyone can help me out with this one, that would be great! thanks.

Have you linked to opengl???

It usally eazy to fix undefined reference error.  What your problem is you are missing a libbary file with the fuction you need in it.  Go Bring up your file search program and look for anything that contans text of the missing futtion.  This would be your 'glOrtho@48'  in your example.  Also put *.a for Filename you are searching for if using mingw or *.lib vc++.   It will then give you a list of libarry wich have the fuction mention pick the name of the libbary and add it to be link in with your program.    

Ps on microsoft xp i had to enable Index seach and change some option so it search for text inside all files.


[0] Message Index

Go to full version