PDA

View Full Version : Opengl - linker errors



shawn619
03-23-2012, 03:52 AM
While attempting to incorporate shaders for PPL, i think i accidently removed a few includes and now my program wont run even with commenting out all the glsl code and reverting back to my original program.

The errors:


1>main.obj : error LNK2019: unresolved external symbol __imp__glutSwapBuffers@0 referenced in function "void __cdecl drawScene(void)" (?drawScene@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol __imp__glutTimerFunc@12 referenced in function "void __cdecl update(int)" (?update@@YAXH@Z)
1>main.obj : error LNK2019: unresolved external symbol __imp__glutPostRedisplay@0 referenced in function "void __cdecl update(int)" (?update@@YAXH@Z)
1>main.obj : error LNK2019: unresolved external symbol __imp__glutMainLoop@0 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glutReshapeFunc@4 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glutKeyboardFunc@4 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glutDisplayFunc@4 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glutCreateWindow@4 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glutInitWindowSize@8 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glutInitDisplayMode@4 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glutInit@8 referenced in function _main
1>C:\Users\Shawn\Documents\New folder\First Project - visual\Light\Debug\Light.exe : fatal error LNK1120: 11 unresolved externals


They appear to be glut errors, but beyond that im not sure.

I tried to backtrack and figure what i did wrong. So i'll name off the things i currently have in my program and whether or not i changed them while trying to get my shader to work.

Includes: (I did remove 1 or 2 that may have caused these errors)


C:\Users\Shawn\Documents\New folder\First Project - visual\Light\Light\glew\include
C:\Users\Shawn\Documents\New folder\First Project - visual\Light\Light\cwc\include
C:\Users\Shawn\Documents\New folder\First Project - visual\Light\Light\freeglut\include
C:\Program Files %28x86%29\Microsoft Visual Studio 10.0\VC\include


Linkers:(Never touched)


SOIL.lib glu32.lib opengl32.lib


And the includes in my program:


#include <stdlib.h>
#include <gl/glut.h>
#include <SOIL.h>
#include <string>
#include <iostream>


I would greatly appreciate help!

menzel
03-23-2012, 03:57 AM
Shouldn't glut be in the list of libs to link to?

shawn619
03-23-2012, 04:16 AM
Naw, i never touched the linkers since it originally worked. And im not sure but i think glu32 includes glut.

V-man
03-23-2012, 09:07 AM
http://www.opengl.org/wiki/FAQ#Unresolved_External_Symbol

shawn619
03-23-2012, 09:45 AM
I'v seen that webpage before but it didn't help me

EthanIowa
03-23-2012, 11:35 AM
Hi,

This error is most likely not related to your #includes.

The "unresolved external symbol" means that your compiler cannot find that function in any of the libraries you currently link with. Since all the missing functions appear to be from glut, it seems you are not linking correctly with it. This guide might help you get started with glut:

http://www.divms.uiowa.edu/~cwyman/classes/common/howto/winGLUT.html

shawn619
03-24-2012, 12:09 AM
I moved some files around and it looks like i'v solved it, thanks guys!

ashwin
04-18-2012, 05:03 PM
Hi,

This error is most likely not related to your #includes.

The "unresolved external symbol" means that your compiler cannot find that function in any of the libraries you currently link with. Since all the missing functions appear to be from glut, it seems you are not linking correctly with it. This guide might help you get started with glut:

http://www.divms.uiowa.edu/~cwyman/classes/common/howto/winGLUT.html

thanks a lot for the web page link.including some lib to my project list solved the problem of link errors really helped me out.