我正在用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++速成版。对不起,我忘了说了。
发布于 2012-05-06 09:53:00
您可能还没有安装GLUT:
来源: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.libReprinted from here
发布于 2016-10-13 22:22:32
如果您正在使用Visual Studio Community 2015并尝试安装GLUT,则应该将头文件glut.h放在C:\Program Files (x86)\Windows Kits\8.1\Include\um\gl中
发布于 2017-09-25 21:26:44
Visual Studio社区2017
点击此处:C:\Program Files (x86)\Windows Kits\10
并在与13的给定目录中执行任何您应该执行的操作。
在lib文件夹中,您可以找到一些版本,我将32位glut.lib文件复制到中,并将和x86以及64位glut.lib复制到arm64和x64目录下的um文件夹中,以获取我能找到的每个版本。
这对我很管用。
编辑:我在Windows10下试过了,也许你需要进入Windows8/8.1的C:\Program Files (x86)\Windows Kits\8.1文件夹。
https://stackoverflow.com/questions/10467473
复制相似问题