Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ubuntu上对OpenGL的未定义引用_Opengl_Cmake_Glut_Freeglut - Fatal编程技术网

Ubuntu上对OpenGL的未定义引用

Ubuntu上对OpenGL的未定义引用,opengl,cmake,glut,freeglut,Opengl,Cmake,Glut,Freeglut,我得到了所有这些未定义的引用: Linking CXX executable SimpleGavam ../../lib/local/Gavam/libGavam.a(MeshUtils.cpp.o): In function `Gavam::DrawMesh(cv::Mat_<float>&, cv::Mat_<float> const&, cv::Mat_<int> const&, cv::Vec<double, 6>

我得到了所有这些未定义的引用:

Linking CXX executable SimpleGavam
../../lib/local/Gavam/libGavam.a(MeshUtils.cpp.o): In function `Gavam::DrawMesh(cv::Mat_<float>&, cv::Mat_<float> const&, cv::Mat_<int> const&, cv::Vec<double, 6> const&, double, double, double, double, cv::Size_<int> const&, double, double)':
/home/samuel/Clm-Z/lib/local/Gavam/src/MeshUtils.cpp:189: undefined reference to `glutSwapBuffers'
../../lib/local/Gavam/libGavam.a(MeshUtils.cpp.o): In function `Gavam::InitialiseOpenGLDrawingWindow(int, int, double, double, double)':
/home/samuel/Clm-Z/lib/local/Gavam/src/MeshUtils.cpp:578: undefined reference to `glutInit'
/home/samuel/Clm-Z/lib/local/Gavam/src/MeshUtils.cpp:580: undefined reference to `glutInitDisplayMode'
/home/samuel/Clm-Z/lib/local/Gavam/src/MeshUtils.cpp:582: undefined reference to `glutInitWindowSize'
/home/samuel/Clm-Z/lib/local/Gavam/src/MeshUtils.cpp:584: undefined reference to `glutCreateWindow'
/home/samuel/Clm-Z/lib/local/Gavam/src/MeshUtils.cpp:585: undefined reference to `glutHideWindow'
collect2: error: ld returned 1 exit status
make[2]: *** [exe/SimpleGavam/SimpleGavam] Error 1
make[1]: *** [exe/SimpleGavam/CMakeFiles/SimpleGavam.dir/all] Error 2
我在文件中包含以下内容:

#include <Gavam.h>

#include <math.h>
#include <fstream>

// OPEN GL
#include <GL/gl.h>
#include <GL/freeglut.h>
#包括
#包括
#包括
//开放式总账
#包括
#包括

我做错了什么?

使用CMake标准模块代替链接器标志

我添加了这个,find_包(需要OpenGL)find_包(需要GLUT)include_目录(库${OpenGL_include_DIRS}${GLUT include_DIRS})还添加了目标链接_库(目标名${OpenGL_库}${GLUT libraries})仅供参考:GLUT不是OpenGL的一部分。它通常与OpenGL一起安装,OpenGL.org上有文档,但它不是规范的一部分。
#include <Gavam.h>

#include <math.h>
#include <fstream>

// OPEN GL
#include <GL/gl.h>
#include <GL/freeglut.h>