【问题标题】:Building errors with visual studio使用 Visual Studio 构建错误
【发布时间】:2011-11-20 16:32:22
【问题描述】:

我有一个针对之前提供给我的 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 仍在链接中,所以我不确定我在哪里得到错误以及为什么我无法构建

【问题讨论】:

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


    【解决方案1】:

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

    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++ 项目属性中的 Additional Include Directories 中。

    【讨论】:

    • 但如果是这种情况,为什么我在更改链接设置后没有收到构建错误?编译的所有内容和 .exe 都按照应有的方式运行。你的回复,我现在就看看你说的。
    • 好的,所以我将包含 更改为 并将我从互联网上下载的 glew.h 文件放在目录中。如果它没有找到文件,我仍然不明白为什么它之前正在构建。
    猜你喜欢
    • 2021-04-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-03
    • 2022-01-24
    • 2014-12-24
    • 2017-12-05
    • 1970-01-01
    相关资源
    最近更新 更多