View Full Version : Visual C++ Linking errors
02-20-2001, 10:32 PM
I was wondering if anyone knew why after building a win32 console and ghanging the project settings, and the test file compiles fines, but when I try to build I get the following error:
--------------------Configuration: test - Win32 Debug--------------------
test.obj : error LNK2001: unresolved external symbol ___glutInitWithExit@12
test.obj : error LNK2001: unresolved external symbol ___glutCreateWindowWithExit@8
Debug/test.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
test.exe - 3 error(s), 0 warning(s)
It is telling you the problem. So fix it by adding the glut32.lib!
02-21-2001, 10:02 AM
If glut32.lib wasn't added to the project it would give a lot more unresolved externals. Actually, glut.h uses pre-processor directives to add the library to the project for you, anyway. I think I've heard about this problem using Borland, where you have to #define GLUT_AT_EXIT_HACK or something like that. Never seen it with VC++, though. Maybe your headers and libraries are different versions?
You need the glut32 libery.
I've also had the same problem. Of course you will need to use the Glut32.lib and I have but still the same 3 errors occur. Out of fustration I've compiled using all of the libs, open32, glut,glut32, etc but still I've had no luck.
Can anyone else help?
02-22-2001, 09:42 AM
Press Ctrl+F7 and then press Alt+F7.
In page link and write glut32.lib.
02-22-2001, 02:12 PM
As I already said above, he is probably already linking in the glut32.lib. There are two things that make me pretty sure of this.
First if he WASN'T linking it, he'd get a hell of a lot more linker errors.
Second, glut.h already links them for you. (At least it does if you use VC++, which he's using.)
Take a look at the glut.h for a moment. You'll notice some lines that look something like so..
#pragma comment (lib, "winmm.lib") /* link with Windows MultiMedia lib */
#pragma comment (lib, "opengl32.lib") /* link with Microsoft OpenGL lib */
#pragma comment (lib, "glu32.lib") /* link with OpenGL Utility lib */
#pragma comment (lib, "glut32.lib") /* link with Win32 GLUT lib */
Those lines will cause those libraries to be linked into the project for you, so you don't even really need to put the libraries in the project settings.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.