# [Solved] Visual C++ Express/OpenGL... what am I missing.

## Recommended Posts

CombatHammie    122
OK, so I installed the PSDK. Added the directories... all as instructed. And yet I still get errors when trying to compile anything that has <gl.h> or <gl\...> in it. What did I miss? EDIT: Here are all the screens I can think of: [Edited by - CombatHammie on December 16, 2006 9:46:22 PM]

##### Share on other sites
Palidine    1315
post the errors. You're probably just not linking to the correct libraries.

-me

##### Share on other sites
el conquist    124
#pragma comment(lib, "opengl32.lib")

to the top of your main file.

##### Share on other sites
CombatHammie    122
1>------ Build started: Project: Simple, Configuration: Debug Win32 ------1>Compiling...1>Simple.cpp1>c:\...\simple\simple.cpp(1) : fatal error C1083: Cannot open include file: 'gl\glut.h': No such file or directory1>Build log was saved at "...\Debug\BuildLog.htm"1>Simple - 1 error(s), 0 warning(s)========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

#pragma comment(lib, "opengl32.lib") yields the same result.

##### Share on other sites
Palidine    1315
search you hard drive for gl.h Is it there?

If it is there, you need to go into your project settings and enter the path to that file under "additional include directories" in the properties section of the compiler settings.

right click on the project in the solution explorer -> properties -> C/C++ -> General -> Additional Include Directories.

Installing the SDK should have set the classpath environment variable up correctly but whatevs. just make sure the gl.h header actually exists on your machine. =)

-me

##### Share on other sites
bubu LV    1436
GLUT has nothing to do with standart GL or GLU headers.
GLUT is completly independent library.
So it must be installed independently from PSDK.
Hint: get FreeGLUT - http://freeglut.sourceforge.net/

##### Share on other sites
el conquist    124
The Microsoft PSDK doesn't come with glut, you need to download it online. After you download it just copy the appropriate files into the appropriate folders within your PSDK (for example put the glut.h file with the PSDK "gl" folder) so you don't have to be bothered to add additional include folders in your project settings.

##### Share on other sites
CombatHammie    122
Thanks bubu, I completely forgot that GLUT is seperate.

Nevertheless, it's just a side thing. GL.h IS on the machine (in the PSDK) folder.

And no, it looks like classpath environment variables were NOT set automatically during the installation. So the question is what to do now.

[Edited by - CombatHammie on December 15, 2006 6:11:52 PM]

##### Share on other sites
common    138
Quote:
 Original post by CombatHammieThanks bubu, I completely forgot that GLUT is seperate.Nevertheless, it's just a side thing. GL.h IS on the machine (in the PSDK) folder.And no, it looks like classpath environment variables were NOT set automatically during the installation. So the question is what to do now.

After you've got glut.h being found what errors do you get? If it says you're missing gl.h or glu.h simply go to Tools->Options, then under the Projects and Solutions node click on VC++ Directories and then add the directories to the PSDK under the right list ("Executable Files", "Include Files", etc.) [smile]

For example, I had to manually add "C:\Program Files\Microsoft Platform SDK\Include" into my "Include Files" list.

##### Share on other sites
CombatHammie    122
Quote:
Original post by common
Quote:
 Original post by CombatHammieThanks bubu, I completely forgot that GLUT is seperate.Nevertheless, it's just a side thing. GL.h IS on the machine (in the PSDK) folder.And no, it looks like classpath environment variables were NOT set automatically during the installation. So the question is what to do now.

After you've got glut.h being found what errors do you get? If it says you're missing gl.h or glu.h simply go to Tools->Options, then under the Projects and Solutions node click on VC++ Directories and then add the directories to the PSDK under the right list ("Executable Files", "Include Files", etc.) [smile]

For example, I had to manually add "C:\Program Files\Microsoft Platform SDK\Include" into my "Include Files" list.

I'll deal with glut later, right now I can't even compile anything with gl.h

I added the directories as needed. There is a file that has to be edited, I know for sure that that's the reason behind the problem. What are the files that have to be added? (opengl32.lib is one of them)

##### Share on other sites
common    138
Oh! Are you talking about the corewin_express.vsprops file?

<?xml version="1.0"?><VisualStudioPropertySheet 	ProjectType="Visual C++" 	Version="8.00" 	Name="Core Windows Libraries">	<Tool 		Name="VCLinkerTool" 		AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib" /></VisualStudioPropertySheet>

EDIT: Find it in "C:\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaults" [smile]

I really hope that solves your problems!

EDIT2: A quick Google found this site: http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/

##### Share on other sites
CombatHammie    122
Quote:
 Original post by commonOh! Are you talking about the corewin_express.vsprops file?If so you have to change it to add additional dependencies. Mine reads as such:  EDIT: Find it in "C:\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaults" [smile]I really hope that solves your problems!

I already have all of those files listed. (I was under the impression that opengl had files of its own. Common, does that compile and work perfectly?

I went to MSDN's website, and it looks like a common problem. In fact, I tried putting #include <windows.h>... doesn't compile!!! :(

Is there are solution to this? I really don't want to spend my christmas vacation trying to figure it out, I want to study opengl instead.

##### Share on other sites
common    138
Could you post all of your code and all of the contents of the output window?

EDIT: If you follow the instructions within the MSDN link in my last post you should be able to create a new Win32 project that is configured correctly. From there all you must do is link to the OpenGL library from within your project. (the #pragma comment(lib, "opengl32.lib") and #pragma comment(lib, "glu32.lib") statements, or in your project settings). Then from there your application should compile. I can't say anything more until I see what sort of errors you are getting.

##### Share on other sites
CombatHammie    122
The code is the first sample from Dave Astle's "Beginning OpenGL", he might be sour at me if I post the example here, who knows.

But the problem is not in the code, the problem occurs as soon as the compiler hits the include statement.

If I create an empty project, empty file and put an empty main() along with #include <gl.h>, compiler will terminate at the include statement and say that gl.h is not found.

##### Share on other sites
common    138
Quote:
 Original post by CombatHammieThe code is the first sample from Dave Astle's "Beginning OpenGL", he might be sour at me if I post the example here, who knows.But the problem is not in the code, the problem occurs as soon as the compiler hits the include statement.If I create an empty project, empty file and put an empty main() along with #include , compiler will terminate at the include statement and say that gl.h is not found.

Okay, well the problem then is that the compiler simply cannot find the gl.h file, and this will have nothing to do with any unlinked libraries or anything else, simply that the compiler does not have the right folder to find that file.

Try to make sure that the include directory is pointing to the PSDK's include directory. Just go to Tools->Options then select VC++ Directories under Projects and Solutions then select "Include Files" press the folder icon to insert a new directory, then copy in or browse for the PSDK \Include directory.

If the build output says that it can't find an include it's just your paths are wrong, given that the file exists on your machine. It will explicitly tell you if there is a link error.

Also, make sure it's "#include <gl/gl.h>"

##### Share on other sites
CombatHammie    122
Quote:
Original post by common
Quote:
 Original post by CombatHammieThe code is the first sample from Dave Astle's "Beginning OpenGL", he might be sour at me if I post the example here, who knows.But the problem is not in the code, the problem occurs as soon as the compiler hits the include statement.If I create an empty project, empty file and put an empty main() along with #include , compiler will terminate at the include statement and say that gl.h is not found.

Okay, well the problem then is that the compiler simply cannot find the gl.h file, and this will have nothing to do with any unlinked libraries or anything else, simply that the compiler does not have the right folder to find that file.

Try to make sure that the include directory is pointing to the PSDK's include directory. Just go to Tools->Options then select VC++ Directories under Projects and Solutions then select "Include Files" press the folder icon to insert a new directory, then copy in or browse for the PSDK \Include directory.

If the build output says that it can't find an include it's just your paths are wrong, given that the file exists on your machine. It will explicitly tell you if there is a link error.

Also, make sure it's "#include <gl/gl.h>"

That's exactly the problem. As I mentioned, I've done those things. I followed Microsoft's MSDN instructions to the letter... and it just won't work.

And yes, in the code it is gl\gl.h, I manually typed the sample here and forgot to put gl\.

This is very disappointing :( I was going to get a head start on OpenGL while college is out, but now I Am banging my head on the table.

Jamil    122

##### Share on other sites
CombatHammie    122
Quote:
 Original post by JamilWhere are your gl.h and glu.h files located on your machine?

\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\gl

##### Share on other sites
CombatHammie    122
Anyone?

##### Share on other sites
Ezbez    1164
Can you post your new errors?

##### Share on other sites
CombatHammie    122
Quote:
 Original post by EzbezCan you post your new errors?

Nothing changed.

1>------ Build started: Project: Simple, Configuration: Debug Win32 ------1>Compiling...1>Simple.cpp1>c:\...\simple\simple.cpp(1) : fatal error C1083: Cannot open include file: 'gl\gl.h': No such file or directory1>Build log was saved at "...\Debug\BuildLog.htm"1>Simple - 1 error(s), 0 warning(s)========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

##### Share on other sites
crazyde    122
Make sure you have the right stuff capitalized. If I'm not mistaken, in the most recent versions of the SDK you want to look for the file "gl/GL."

Sorry if this has already been suggested.

##### Share on other sites
common    138
Try making a new project using the New Project wizard and just have an empty main loop and try including gl.h in that file. If that doesn't work then you've made a mistake adding the project directories.

If you're not sure after looking through your settings just post a screenshot of your include directory paths and post it here.

EDIT: Try what crazyde said first, I had no idea about that [smile]

##### Share on other sites
CombatHammie    122
Quote:
 Original post by crazydeMake sure you have the right stuff capitalized. If I'm not mistaken, in the most recent versions of the SDK you want to look for the file "gl/GL."Sorry if this has already been suggested.

No effect.

##### Share on other sites
CombatHammie    122
Posted the screenshots. If there is anything wrong there, than I just don't see it.