OPENgl - GL / glut.h没有这样的文件或目录 [英] OPENgl - GL/glut.h no such file or directory

查看:2416
本文介绍了OPENgl - GL / glut.h没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

p>我做的事情是


  1. 安装MinGW后,我添加了路径
    enviornment变量

  2. 向C:\MinGW\Include\GL添加了glut.h

  3. 将glut32.dll添加到C:\Windows \SysWOW64

  4. 将glut32.lib添加到项目文件夹

  5. 与'g ++ -o hello.exe -Wall hello.c glee.lib glut32.lib -lopengl32 -lglu32'

仍然出现上述错误请帮助

 #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 );
}
}

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();
}


解决方案




  • 检查 C:\\ \\ MinGW \bin 在您的路径变量中,如果没有,请将 C:\MinGW\bin 添加到您的路径(类型%在控制台窗口中,以确保路径属性应用于您正在使用的窗口控制台会话)

  • glut32.dll code> C:\windows \system32 ,因此它可以位于运行时,或者将其放在与您要运行的可执行文件相同的目录中

  • 刚刚检查,我的minGW在 c:\mingw\bin
  • 中有 glut32.dll >
  • libglut32.a c:\mingw\lib

  • glut.h 应该在 c:\mingw\include\GL



对以前的遗漏表示道歉。





如果您需要更多信息/帮助,请告诉我们:)



附录:



我找到了这个链接,虽然旧的可能会对您使用的文件可用于mingw的环境。


can any one help me with the following error

GL/glut.h no such file or directory

The things I did are

  1. After installation of MinGW i have added the Path to the path enviornment variable
  2. Added 'glut.h' to C:\MinGW\Include\GL
  3. Added glut32.dll to C:\Windows\SysWOW64
  4. Added glut32.lib to the project folder
  5. COmpiled with '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)
  • 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 run
  • Just checked and my minGW has glut32.dll in c:\mingw\bin
  • and libglut32.a in c:\mingw\lib
  • and glut.h should be in 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.

这篇关于OPENgl - GL / glut.h没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆