[英]OPENgl - GL/glut.h no such file or directory
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我做的事情是
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();
}
some simple things that can cause problems in my experience (so make sure they are set!:) :一些简单的事情可能会导致我的经验出现问题(所以请确保它们已设置!:):
C:\\MinGW\\bin
is in your path variable if not, add C:\\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)C:\\MinGW\\bin
是否在您的路径变量中,如果没有,请将C:\\MinGW\\bin
到您的 PATH(在控制台窗口中键入 %path% 以确保路径属性应用于您的窗口控制台会话)正在使用)glut32.dll
into C:\\windows\\system32
so it can be located at runtime, or place it in the same directory as the executable you wish to runglut32.dll
放入C:\\windows\\system32
以便它可以在运行时定位,或者将它放在与您希望运行的可执行文件相同的目录中glut32.dll
in c:\\mingw\\bin
c:\\mingw\\bin
有glut32.dll
libglut32.a
in c:\\mingw\\lib
c:\\mingw\\lib
libglut32.a
glut.h
should be in c:\\mingw\\include\\GL
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 link which whilst old may be of use to you in making the files available to mingw's environment.我找到了这个链接,虽然旧可能对您有用,可以使文件可用于 mingw 的环境。
在基于 Debian 的系统(例如 Ubuntu)上,请执行
sudo apt-get install libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.