简体   繁体   English

OPENgl - GL/glut.h 没有这样的文件或目录

[英]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我做的事情是

  1. After installation of MinGW i have added the Path to the path enviornment variable安装 MinGW 后,我已将 Path 添加到路径环境变量中
  2. Added 'glut.h' to C:\\MinGW\\Include\\GL将“glut.h”添加到 C:\\MinGW\\Include\\GL
  3. Added glut32.dll to C:\\Windows\\SysWOW64将 glut32.dll 添加到 C:\\Windows\\SysWOW64
  4. Added glut32.lib to the project folder将 glut32.lib 添加到项目文件夹
  5. COmpiled with 'g++ -o hello.exe -Wall hello.c glee.lib glut32.lib -lopengl32 -lglu32'用'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();
}

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, 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% 以确保路径属性应用于您的窗口控制台会话)正在使用)
  • put 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以便它可以在运行时定位,或者将它放在与您希望运行的可执行文件相同的目录中
  • Just checked and my minGW has glut32.dll in c:\\mingw\\bin刚刚检查过,我的 minGW 在c:\\mingw\\binglut32.dll
  • and libglut32.a in c:\\mingw\\libc:\\mingw\\lib libglut32.a
  • and glut.h should be in c:\\mingw\\include\\GLglut.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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM