23

私は C++ で OpenGL プログラミングを行っていました。

これは私のコードの一部です:

#include <time.h>
#include <windows.h>
#include <gl/gl.h>
#include <gl/glu.h>
#include <gl/glut.h> <<< Error here "Cannot open source file gl/glut.h"

どうすればこれを修正できますか?

編集: Microsoft Visual C++ Express Edition を使用しています。言い忘れてすみません

4

5 に答える 5

26

GLUT をインストールしていない可能性があります。

  1. GLUT のインストール GLUT がマシンにインストールされていない場合は、次からダウンロードできます: http://www.xmission.com/~nate/glut/glut-3.7.6-bin.zip (または任意のバージョン) GLUT ライブラリとヘッダー ファイルは次のとおりです。 • glut32.lib • glut.h

ソース: http://cacs.usc.edu/education/cs596/OGL_Setup.pdf

編集:

最も簡単な方法は、最新のヘッダーとコンパイル済みの DLL をダウンロードし、system32 フォルダーに配置するか、プロジェクトで参照することです。バージョン 3.7 (この記事の時点で最新) はこちら: http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip

Folder references:

glut.h: 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\GL\'
glut32.lib: 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\'
glut32.dll: 'C:\Windows\System32\'

For 64-bit machines, you will want to do this.
glut32.dll: 'C:\Windows\SysWOW64\'

Same pattern applies to freeglut and GLEW files with the header files in the GL folder, lib in the lib folder, and dll in the System32 (and SysWOW64) folder.
1. Under Visual C++, select Empty Project.
2. Go to Project -> Properties. Select Linker -> Input then add the following to the Additional Dependencies field:
opengl32.lib
glu32.lib
glut32.lib

ここから転載

于 2012-05-06T01:52:59.553 に答える
6

Visual Studio Community 2015 を使用していて、GLUT をインストールしようとしている場合は、ヘッダー ファイルを次の場所に配置する必要がありますglut.hC:\Program Files (x86)\Windows Kits\8.1\Include\um\gl

于 2016-10-13T14:22:32.153 に答える
0

必要なものはすべてここにあります。

http://web.eecs.umich.edu/~sugih/courses/eecs487/glut-howto/#win

于 2013-03-22T22:06:39.093 に答える