2011-09-20 176 views
2

我有一个为我提供的以前的C++项目的解决方案。当我打开Visual Studio中的解决方案,并尝试建立,我得到的错误:用Visual Studio构建错误

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 directory 
1> 
1>Build FAILED. 
1> 
1>Time Elapsed 00:00:00.85 
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 

我不得不改变我的项目输入连接器设置包括glew32d.lib。这解决了它,它编译和运行正常。

然而,当我改变example1.cpp(甚至只需添加评论),我不再能够构建它,我得到这个错误:

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仍然被链接所以我米不知道我在哪里得到的错误,为什么我不能建立

回答

3

这不是一个链接器错误,这是一个编译错误。

c:\users\mycomp\downloads\stp\testp\code\Angel.h(38): fatal error C1083:... 
             ^^^^^^^^^^^ 

我赌Angel.h的38行,你想包括...

...Cannot open include file: 'GL/glew.h': No such file or directory 
          ^^^^^^^^^^^ 

...和编译器找不到头文件。

您需要确保OpenGL头文件(任何文件夹包含名为GL的文件夹包含名为glew.h的文件)都可用于编译器;您可以将此文件夹添加到您的C++项目的属性中的其他包含目录。

+0

但是如果是这样的话,为什么我在更改链接设置后没有出现构建错误?编译的所有东西以及.exe都按照它应有的方式运行。为了答复,我要看看你现在说的话。 – y3di

+0

好,所以我改变了包括,并把一个glew.h文件我在互联网上的目录下。如果没有找到该文件,我仍然不明白为什么它会在之前构建。 – y3di

相关问题