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
伊谢尔伦2017-04-17 13:53:22
The error reported here is very obvious
文件包含自 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' 函数没有声明
The first two were saved because you did not install the glu
and gl
header files.
The latter one is because there is no glfwSleep
function.
Only glfw
is not enough.