Opening Program elsewhere

I’m writing an opengl program in an MDI application using visual C++ version 6.0
When I work on the program at work and then take it home, it works fine. But when I work on it at home and then try to run it again at work, I get errors when I compile.

Here’s some of the errors:
:\Windows\Desktop\Heart Program newest\TestGLView.cpp(227) : error C2065: ‘glEnable’ : undeclared identifier
C:\Windows\Desktop\Heart Program newest\TestGLView.cpp(229) : error C2065: ‘glClearColor’ : undeclared identifier
C:\Windows\Desktop\Heart Program newest\TestGLView.cpp(231) : error C2065: ‘glClearDepth’ : undeclared identifier
C:\Windows\Desktop\Heart Program newest\TestGLView.cpp(234) : error C2065: ‘glLightfv’ : undeclared identifier
C:\Windows\Desktop\Heart Program newest\TestGLView.cpp(271) : error C2065: ‘glBegin’ : undeclared identifier

In fact, every error I get is of this sort. That the OpenGL commands are undeclared identifiers. I checked if the headers files were included and they were. I also checked if the appropriate libraries were linked and they were. Its the exact same program, works fine at home but screws up at work after it has been run at home. Its also the exact same version of visual C++. Anybody know what the problem is and how I could fix it?

I checked if the headers files were included and they were.

you checked that the headers were included in TestGLView.cpp? did you also check in VC98/include/GL for the headers?

Note: headers are in GL subfolder under the include dir. make sure you have:
#include <gl/gl.h>


already checked for all that. The thing thats getting me is that it works fine at work, then fine at home, but when it comes back to work after being used at home, only then do these errors come. I’m not sure what the problem is.

What I usually do is just take the cpp and h files back and forth between work and home and leave the M$ Project related files on both installations (do not exchange these). You do have to duplicate all the file additions to the project and other project setup though.
Another thing that may help is to clean up the intermediate files and do a complete rebuild, or you could get rid of the precompiled stuff (and the stdafx or whatever - not just the include, but it has to be removed from the project properties too!).

If that does not work then it probably has something to do with the general properties of M$ Visual Studio, not the project related stuff. Compare the setups on the worksite and at home to try and find the differences

Good luck,


This is just a thought, but did you put the #include <GL/gl.h> into stdafx.h? Maybe you are running into a problem related to precompiled headers, or some such thing. Try to use Build->Clean, and then attempt compiling.

Other than that all I can say is that it really just sounds like #include <GL/gl.h> isn’t in that cpp file.

I agree with JML and Deiussum. Clean intermediate files then do a build. Also only transfer your C/CPP and H files (and your resource files if you have any).

Just a thought. Do your paths to files at home and at work match? It could be that your home version of M$ VC is playing around with some path in the files you transfer.