本文介绍了如何解决此错误:#include< gl/glut.h> “无法打开源文件gl/glut.h";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用C ++进行一些OpenGL编程.

I was doing some OpenGL programming in C++.

这是我的代码的一部分:

This is part of my code:

#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.抱歉忘了提

I am using Microsoft Visual C++ Express Edition. Sorry forgot to mention it

推荐答案

您可能尚未安装GLUT:

You probably haven't installed GLUT:

  1. 安装GLUT如果您的计算机上未安装GLUT,则可以从以下位置下载: http://www.xmission.com/~nate/glut/glut-3.7. 6-bin.zip (或任何版本)GLUT库和头文件是•glut32.lib•glut.h
  1. Install GLUTIf you do not have GLUT installed on your machine you can download it from:http://www.xmission.com/~nate/glut/glut-3.7.6-bin.zip (or whatever version)GLUT Libraries and header files are• 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

The quickest way is to download the latest header, and compiled DLLs for it, place it in your system32 folder or reference it in your project. Version 3.7 (latest as of this post) is here: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

从此处转载

这篇关于如何解决此错误:#include&lt; gl/glut.h&gt; “无法打开源文件gl/glut.h";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 07:47