Open shuzhangshu opened 1 year ago
Add Link to OpenGL in CMakeLists.txt works for me.
project("DeepSDF")
cmake_minimum_required(VERSION 3.0)
find_package(CLI11 CONFIG REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(nanoflann REQUIRED)
find_package(Pangolin REQUIRED)
find_package(GLEW REQUIRED)
find_package(OpenGL REQUIRED)
message(STATUS ${GLEW_LIBRARIES})
include_directories(${GLEW_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIRS})
add_subdirectory(third-party/cnpy)
set(SOURCES
src/ShaderProgram.cpp
src/Utils.cpp)
add_executable(PreprocessMesh src/PreprocessMesh.cpp ${SOURCES})
target_include_directories(PreprocessMesh PRIVATE third-party/cnpy)
target_link_libraries(PreprocessMesh PRIVATE CLI11::CLI11 pangolin cnpy Eigen3::Eigen nanoflann::nanoflann ${GLEW_LIBRARIES} ${OPENGL_LIBRARIES})
target_compile_features(PreprocessMesh PRIVATE cxx_std_14)
set_target_properties(PreprocessMesh PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin")
add_executable(SampleVisibleMeshSurface src/SampleVisibleMeshSurface.cpp ${SOURCES})
target_include_directories(SampleVisibleMeshSurface PRIVATE third-party/cnpy)
target_link_libraries(SampleVisibleMeshSurface PRIVATE CLI11::CLI11 pangolin cnpy Eigen3::Eigen nanoflann::nanoflann ${GLEW_LIBRARIES} ${OPENGL_LIBRARIES})
target_compile_features(SampleVisibleMeshSurface PRIVATE cxx_std_14)
set_target_properties(SampleVisibleMeshSurface PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin")
/usr/bin/ld: CMakeFiles/SampleVisibleMeshSurface.dir/src/SampleVisibleMeshSurface.cpp.o: undefined reference to symbol 'glGetTexImage' /usr/bin/ld: /lib/x86_64-linux-gnu/libOpenGL.so.0: error adding symbols: DSO missing from command line Hello!I displayed this error when compiling, but I did not find a solution. Can you help me?