编译D435出错
CMake Error: The following variables are used in this project,but they are set to NOTFOUND.
第一步,下载glfw
到地址www.glfw.org下载glfw source code:glfw-3.2.1.zip,解压
$unzip glfw-3.2.1.zip -d glfw-3.2.1
第二步,编译安装glfw
1. 安装依赖库,
$sudoapt-get build-dep glfw
$sudo apt-get install cmake xorg-dev libglu1-mesa-dev
2.进入 glfw3-3.x.x 目录,建立glfw-build子目录,
$sudo mkdir glfw-build
3. 进入glfw-build,使用cmake命令生成Makefile
$sudo cmake ../
4. make && make install
$sudo make
$sudo make install
第三步,使用glfw
建立main.cpp 输入下面的代码:
- #include
- intmain(void)
- {
- GLFWwindow*window;
- /*Initializethelibrary*/
- if(!glfwInit())
- return-1;
- /*CreateawindowedmodewindowanditsOpenGLcontext*/
- window=glfwCreateWindow(640,480,"HelloWorld",NULL,NULL);
- if(!window)
- {
- glfwTerminate();
- return-1;
- }
- /*Makethewindow'scontextcurrent*/
- glfwMakeContextCurrent(window);
- /*Loopuntiltheuserclosesthewindow*/
- while(!glfwWindowShouldClose(window))
- {
- /*Renderhere*/
- /*Swapfrontandbackbuffers*/
- glfwSwapBuffers(window);
- /*Pollforandprocessevents*/
- glfwPollEvents();
- }
- glfwTerminate();
- return0;
- }