c++ - MinGW+GLFW配置openGL开发环境错误
阿神
阿神 2017-04-17 13:51:22
[C++讨论组]

MinGW 配置glfw有如下结构环境:

MinGW
+- include
|   +- GLFW
|      +- glfw3.h
+- lib
   +- libglfw3.a
   +- libglfw3dll.a

运行如下程序:

#include<cstdio>
#include<GL/glew.h>
#include<GLFW/glfw3.h>

int main()
{
    glfwInit();
    glfwSleep(1.0);
    glfwTerminate();
    return 0;
}

运行如下命令:

!g++ test.cpp -g -o test.exe -lgfw3dll -lopengl32

出现如下结果:

In file included from test.cpp:2:
H:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/GL/glew.h:1202:24: GL/glu.h: No such file or directory
In file included from test.cpp:3:
H:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/GLFW/glfw3.h:168:21: GL/gl.h: No such file or directory
test.cpp: In function `int main()':
test.cpp:8: error: `glfwSleep' was not declared in this scope
阿神
阿神

闭关修行中......

全部回复(1)
伊谢尔伦

这里报的错误很明显啊

文件包含自 test.cpp第2行:
在文件glew.h中1202行24列: GL/glu.h: 没有找到文件或目录
文件包含自 test.cpp第3行:
文件GLFW/glfw3.h中168行21列: GL/gl.h: 没有找到文件或目录

test.cpp: 在函数 `int main()':
test.cpp:8: error: `glfwSleep' 函数没有声明

前两个保存时因为你没有安装glu以及gl的头文件。
后一个是因为没有glfwSleep这个函数。

光有glfw是不够的。

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号