Building errors with visual studio
I have a solution for a previous c++ project provided to me. When I open the solution in visual studio and try to build, I get the error:
1>------ Build started: Project: Test Proj, Configuration: Release Win32 ------
1>Build started 9/19/2011 8:28:56 PM.
1>InitializeBuildStatus:
1> Touching "Release\Test Proj.unsuccessfulbuild".
1>ClCompile:
1> example1.cpp
1>c:\users\mycomp\downloads\stp\testp\code\Angel.h(38): fatal error C1083: Cannot open include file: 'GL/glew.h': No such file or directory
1> InitShader.cpp
1>c:\users\mycomp\downloads\stp\testp\code\Angel.h(38): fatal error C1083: Cannot open include file: 'GL/glew.h': No such file or director开发者_JAVA技巧y
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.85
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I had to change the input linker settings of my project to include glew32d.lib. That fixes it, and it compiles and runs properly.
However, when I alter example1.cpp(even by just adding a comment), I am no longer able to build it and I get this error:
1>------ Build started: Project: Test Proj, Configuration: Release Win32 ------
1>Build started 9/19/2011 8:25:29 PM.
1>InitializeBuildStatus:
1> Creating "Release\Test Proj.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1> example1.cpp
1>c:\users\mycomp\downloads\stp\testp\code\Angel.h(38): fatal error C1083: Cannot open include file: 'GL/glew.h': No such file or directory
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.67
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
glew32d is still being linked so I'm not sure where I'm getting the error and why I can't build
That's not a linker error, it's a compile error.
c:\users\mycomp\downloads\stp\testp\code\Angel.h(38): fatal error C1083:...
^^^^^^^^^^^
I bet on line 38 of Angel.h, you're trying to include...
...Cannot open include file: 'GL/glew.h': No such file or directory
^^^^^^^^^^^
...and the compiler can't find the header file.
You need to make sure that the OpenGL header files (whatever folder contains a folder named GL that contains a file called glew.h) are available to the compiler; you can add this folder to the Additional Include Directories in the properties of your C++ project.
精彩评论