View Full Version : Problem compiling gl.h, glu.h, etc. w/MSVC++

11-01-2000, 05:13 PM
To date, I've based my tests on NeHe's base code. However, I've recently decided to start my own OpenGL app using MSVC++. However, I can't get the stupid thing to compile. Namely, the linker has a problem with all the GL calls. The weird thing is, I'll open up one of NeHe's project workspaces in VC++ and can compile with no problems. But I can create a new workspace and copy and paste ALL the code from NeHe's files in and no dice! Why would my compiler work with the very same code only with a different workspace and then fail with the very same code in another? I can't figure this one out. Does anyone have any idea why this would happen? Thanks!

11-01-2000, 05:27 PM
Does it fail when compiling or linking? If its linking then you probably forgot to include the opengl32.lib and glut32.lib files

11-02-2000, 05:23 AM
Well, first of all, the Microsoft platform SDK doesn't seem to have included the .LIB files, only the .H files. The problem is with linking. But the weird thing is that NeHe's apps will compile and link just fine and they don't have the .LIB files setup in the project. Perhaps they don't need to be re-linked since they were already linked to the app previously for some reason?

11-02-2000, 06:05 AM
If you can compile NeHe's files/projects, you can compile your own code aswell, but you must add these library files to your project on your own, because they are not included by default. In MSVC, you can do this from the Project menu, under Settings, select the Link tab, and add opengl32.lib to the Modules textbox.

11-02-2000, 06:13 AM
Okay, I'll try this... perhaps NeHe's project files have those .LIBs setup but they just don't show up in the workspace file list? Ohwell... I'll give this a shot and write back about if it works or not. Thanks!

11-02-2000, 06:16 AM
Correct, in MSVC++, you will not normally see those libs listed in the workspace.
But they are in the project settings.

11-02-2000, 07:25 AM
Cool! Looks like that is what was wrong. Another thing I had done wrong is that I didn't create the project as a "Win32 application". Incase anyone else is wondering, not having it set to a Win32 application will cause a linker error of an unrecognized symbol "_main". Make sense. Anyway, thanks for all your help, guys!