安装
sudo apt install libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev
下载 https://github.com/glfw/glfw/releases/download/3.3.2/glfw-3.3.2.zip
解压到 ~/glfw-3.3.2
mkdir ~/glfw-3.3.2/build
cd ~/glfw-3.3.2/build
cmake ~/glfw-3.3.2 或../
make
make install
下面这段 可以在节里,也可加在debug/release的target节里
<Linker>
<Add library="glfw3" />
<Add library="GLEW" />//不重要
<Add library="GL" />
<Add library="X11" />
<Add library="Xrandr" />
<Add library="Xi" />
<Add library="Xinerama" />
<Add library="Xxf86vm" />//不重要
<Add library="Xcursor" />
<Add library="pthread" />
<Add library="dl" />
<Add library="m" />//不重要
<Add library="rt" />//不重要
</Linker>
上面选项 当然也可以通IDE中添加。 选择 菜单(project/Built options) 或 (project/project properties/project settrings/project built options/link settings)
测试代码
#include <stdio.h>
#include <GLFW/glfw3.h>
int main()
{
glfwInit();
printf("glfw3 Init test.");
return 0;
}
|