C++ OPENgl - GL/glut.h 没有这样的文件或目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19858072/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
OPENgl - GL/glut.h no such file or directory
提问by Siddharth Taunk
can any one help me with the following error
任何人都可以帮助我解决以下错误
GL/glut.h no such file or directory
GL/glut.h 没有这样的文件或目录
The things I did are
我做的事情是
- After installation of MinGW i have added the Path to the path enviornment variable
- Added 'glut.h' to C:\MinGW\Include\GL
- Added glut32.dll to C:\Windows\SysWOW64
- Added glut32.lib to the project folder
- COmpiled with 'g++ -o hello.exe -Wall hello.c glee.lib glut32.lib -lopengl32 -lglu32'
- 安装 MinGW 后,我已将 Path 添加到路径环境变量中
- 将“glut.h”添加到 C:\MinGW\Include\GL
- 将 glut32.dll 添加到 C:\Windows\SysWOW64
- 将 glut32.lib 添加到项目文件夹
- 用'g++ -o hello.exe -Wall hello.c glee.lib glut32.lib -lopengl32 -lglu32'编译
and still the error above persist please help
仍然上面的错误仍然存在请帮助
#include<GL/glut.h>
#include<iostream>
//#include<conio.h>
void render(void);
void keyboard(unsigned char c, int x, int y);
void mouse(int button, int state, int x, int y);
int main(int argc, char** atgv)
{
glutInit(&argc, argv);
glutInitDisplayMode( GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowPosition(100, 100);
glutInitWindowSize(640, 480);
glutCreateWindow("Sample GLUT Application");
glutDisplayFunc(render);
glutKeyboardFunc(keyboard);
glutMouseFunc(mouse);
glutMainLoop();
}
void keyboard(unsigned char c, int x, int y)
{
if(c == 27){
exit(0);
}
}
void mouse(int button, int state, int x, int y)
{
if(button == GLUT_RIGHT_BUTTON )
{
exit(0);
}
}
void render(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glBegin(GL_TRIANGLES);
glColor3f(1, 0, 0);
glVertex2f(-0.5, -0.5);
glColor3f(0, 1, 0);
glVertex2f(0.5, -0.5);
glColor3f(0, 0, 1);
glVertex2f(0.0, 0.5);
glEnd();
glutSwapBuffers();
}
回答by GMasucci
some simple things that can cause problems in my experience (so make sure they are set!:) :
一些简单的事情可能会导致我的经验出现问题(所以请确保它们已设置!:):
- check to see if
C:\MinGW\bin
is in your path variable if not, addC:\MinGW\bin
to your PATH (type %path% in a console window to ensure the path property is applied to the window console session you are using) - put
glut32.dll
intoC:\windows\system32
so it can be located at runtime, or place it in the same directory as the executable you wish to run - Just checked and my minGW has
glut32.dll
inc:\mingw\bin
- and
libglut32.a
inc:\mingw\lib
- and
glut.h
should be inc:\mingw\include\GL
- 检查是否
C:\MinGW\bin
在您的路径变量中,如果没有,请添加C:\MinGW\bin
到您的 PATH(在控制台窗口中键入 %path% 以确保路径属性应用于您正在使用的窗口控制台会话) - 把
glut32.dll
成C:\windows\system32
这样它可以位于在运行时,或将其放置在同一目录下,你想运行的可执行 - 刚检查过,我的 minGW 已
glut32.dll
在c:\mingw\bin
- 并
libglut32.a
在c:\mingw\lib
- 并且
glut.h
应该在c:\mingw\include\GL
Apologies for the previous omission.
为之前的疏忽道歉。
That should see you alright provided there are no other issues at play.
如果没有其他问题在起作用,那应该可以看到您。
Let me know if you need more info/help :)
如果您需要更多信息/帮助,请告诉我:)
Addendum:
附录:
I located this linkwhich whilst old may be of use to you in making the files available to mingw's environment.
我找到了这个链接,虽然很旧,但它可能对您在使文件可用于 mingw 的环境中有用。