very easy question

Started by
6 comments, last by newbie2005 19 years ago
hi, I'm using visual studio.net 2003. I've been downloading the visual studio.net tutorials from the site to learn, and they do work. But when I tried to create my own empty project and add the *.ccp file into the project, and build it. It gives me lots of errors to do with linkers.
Advertisement
What errors does it give you?
All the errors will appear in the form of:

error LNK2019: unresolved external symbol ...

Well heres the complete list anyway my project name is ox (naughts and cross):


ox fatal error LNK1120: 31 unresolved externals
ox error LNK2019: unresolved external symbol __imp__glBegin@4 referenced in function "int __cdecl DrawGLScene(void)" (?DrawGLScene@@YAHXZ)
ox error LNK2019: unresolved external symbol __imp__glBindTexture@8 referenced in function "int __cdecl LoadGLTextures(void)" (?LoadGLTextures@@YAHXZ)
ox error LNK2019: unresolved external symbol __imp__glBlendFunc@8 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)
ox error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function "int __cdecl DrawGLScene(void)" (?DrawGLScene@@YAHXZ)
ox error LNK2019: unresolved external symbol __imp__glClearColor@16 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)
ox error LNK2019: unresolved external symbol __imp__glClearDepth@8 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)
ox error LNK2019: unresolved external symbol __imp__glColor4f@16 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)
ox error LNK2019: unresolved external symbol __imp__glDepthFunc@4 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)
ox error LNK2019: unresolved external symbol __imp__glDisable@4 referenced in function _WinMain@16
ox error LNK2019: unresolved external symbol __imp__glEnable@4 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)
ox error LNK2019: unresolved external symbol __imp__glEnd@0 referenced in function "int __cdecl DrawGLScene(void)" (?DrawGLScene@@YAHXZ)
ox error LNK2019: unresolved external symbol __imp__glGenTextures@8 referenced in function "int __cdecl LoadGLTextures(void)" (?LoadGLTextures@@YAHXZ)
ox error LNK2019: unresolved external symbol __imp__glHint@8 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)
ox error LNK2019: unresolved external symbol __imp__glLightfv@12 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)
ox error LNK2019: unresolved external symbol __imp__glLoadIdentity@0 referenced in function "void __cdecl ReSizeGLScene(int,int)" (?ReSizeGLScene@@YAXHH@Z)
ox error LNK2019: unresolved external symbol __imp__glMatrixMode@4 referenced in function "void __cdecl ReSizeGLScene(int,int)" (?ReSizeGLScene@@YAXHH@Z)
ox error LNK2019: unresolved external symbol __imp__glNormal3f@12 referenced in function "int __cdecl DrawGLScene(void)" (?DrawGLScene@@YAHXZ)
ox error LNK2019: unresolved external symbol __imp__glRotatef@16 referenced in function "int __cdecl DrawGLScene(void)" (?DrawGLScene@@YAHXZ)
ox error LNK2019: unresolved external symbol __imp__glShadeModel@4 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)
ox error LNK2019: unresolved external symbol __imp__glTexCoord2f@8 referenced in function "int __cdecl DrawGLScene(void)" (?DrawGLScene@@YAHXZ)
ox error LNK2019: unresolved external symbol __imp__glTexImage2D@36 referenced in function "int __cdecl LoadGLTextures(void)" (?LoadGLTextures@@YAHXZ)
ox error LNK2019: unresolved external symbol __imp__glTexParameteri@12 referenced in function "int __cdecl LoadGLTextures(void)" (?LoadGLTextures@@YAHXZ)
ox error LNK2019: unresolved external symbol __imp__glTranslatef@12 referenced in function "int __cdecl DrawGLScene(void)" (?DrawGLScene@@YAHXZ)
ox error LNK2019: unresolved external symbol __imp__glVertex3f@12 referenced in function "int __cdecl DrawGLScene(void)" (?DrawGLScene@@YAHXZ)
ox error LNK2019: unresolved external symbol __imp__glViewport@16 referenced in function "void __cdecl ReSizeGLScene(int,int)" (?ReSizeGLScene@@YAXHH@Z)
ox error LNK2019: unresolved external symbol __imp__wglCreateContext@4 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z)
ox error LNK2019: unresolved external symbol __imp__wglDeleteContext@4 referenced in function "void __cdecl KillGLWindow(void)" (?KillGLWindow@@YAXXZ)
ox error LNK2019: unresolved external symbol __imp__wglMakeCurrent@8 referenced in function "void __cdecl KillGLWindow(void)" (?KillGLWindow@@YAXXZ)
ox error LNK2019: unresolved external symbol _auxDIBImageLoadA@4 referenced in function "struct _AUX_RGBImageRec * __cdecl LoadBMP(char *)" (?LoadBMP@@YAPAU_AUX_RGBImageRec@@PAD@Z)
ox error LNK2019: unresolved external symbol _gluBuild2DMipmaps@28 referenced in function "int __cdecl LoadGLTextures(void)" (?LoadGLTextures@@YAHXZ)
ox error LNK2019: unresolved external symbol _gluPerspective@32 referenced in function "void __cdecl ReSizeGLScene(int,int)" (?ReSizeGLScene@@YAXHH@Z)
Make sure you include the opengl32.lib and glu32.lib files in your project (Project -> <your project name> Properties -> Linker -> Input and then the Additional Dependencies).

EDIT: those linker errors notify you that the linker can not find those functions. This happens when you are not linking to particular library files (collections of functions), in this case the opengl32.lib and glu32.lib libraries. When you changed your project as described above, recompile your program and these linker errors should disappear.

Crafter 2D: the open source 2D game framework

?Github: https://github.com/crafter2d/crafter2d
Twitter: [twitter]crafter_2d[/twitter]

Thanks alot for that.

Just 1 quick question, does that mean I have to include all the libraries I use inside that dependency box? I thought the #include header does that.
Quote:Original post by newbie2005
Thanks alot for that.

Just 1 quick question, does that mean I have to include all the libraries I use inside that dependency box? I thought the #include header does that.
All #include does is include the declarations, you need to add a linker option to link with the object/library file(s) which contain the definitions.
You can use

#pragma comment(lib,"opengl32.lib")

to make it easyer to add.

edit: Fixed typo
Oh I get it now. thanks for the replies.

This topic is closed to new replies.

Advertisement