2

私に提供された以前の 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 はまだリンクされているため、エラーが発生している場所とビルドできない理由がわかりません

4

1 に答える 1

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 ヘッダー ファイル (glew.h というファイルを含む GL という名前のフォルダーが含まれるフォルダー) がコンパイラーで使用可能であることを確認する必要があります。このフォルダーを、C++ プロジェクトのプロパティで追加のインクルード ディレクトリに追加できます。

于 2011-09-20T00:44:37.163 に答える