使用visual studio构建错误

时间:2011-09-20 00:36:19

标签: c++ visual-studio visual-studio-2010 opengl glew

我为之前提供的c ++项目提供了解决方案。当我在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仍然被链接,所以我不确定我在哪里得到错误以及为什么我无法构建

1 个答案:

答案 0 :(得分: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 ++项目属性中的其他包含目录。

相关问题