libigl, GLEW, GLFW и Eigen на CLion, Windows 10. Ошибки компоновщика

Я уверен, что упускаю что-то тривиальное, но я не могу понять, что.

Я строю проект с четырьмя внешними библиотеками, используя CLion. Я пытаюсь связать Eigen, GLEW, GLFW и libigl. Я использую компилятор VC ++ в VS 2015.

Это одна итерация моего файла cmake:

cmake_minimum_required(VERSION 3.9)
project(Lab1)

set(CMAKE_VERBOSE_MAKEFILE ON)

set(CMAKE_CXX_STANDARD 17)

add_executable(Lab1 main.cpp)

include_directories(external/libigl/include)
include_directories(external/glfw/include/)
include_directories(external/eigen-git-mirror/)

include_directories(external/glew_2_1_0/include)

INCLUDE_DIRECTORIES(external/glew_2_1_0/lib/Release/x64)
link_libraries(external/glew_2_1_0/lib/Release/x64)

Я добавил библиотеки glew (32- и 64-битные) в соответствующие папки в VC ++. Я также добавил файлы glew32.dll (64 и 32-разрядные) в соответствующие папки в системных папках. Я не думаю, что мне нужно делать это, если я определяю, где искать их в моем файле Cmake, но я не совсем уверен.

Это моя структура папок в CLion:
Структура папок CLion.

Вот что main.cpp содержит в случае, если это имеет значение:

#include <igl/readOFF.h>
#include <igl/viewer/Viewer.h>

Eigen::MatrixXd V;
Eigen::MatrixXi F;

int main(int argc, char *argv[])
{
// Load a mesh in OFF format
igl::readOFF("bunny.off", V, F);

// Plot the mesh
igl::viewer::Viewer viewer;
viewer.data.set_mesh(V, F);
viewer.launch();
}

Это ошибки компоновщика, которые я получаю.

[100%] Linking CXX executable Lab1.exe
"D:\Actual Program Files\JetBrains\CLion 2017.3.1\bin\cmake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\Lab1.dir --manifests  -- D:\ACTUAL~1\VISUAL~2\VC\bin\link.exe /nologo @CMakeFiles\Lab1.dir\objects1.rsp @C:\Users\Mohammed\AppData\Local\Temp\nm6742.tmp
main.cpp.obj : error LNK2019: unresolved external symbol __imp__glBindTexture@8 referenced in function "public: void __thiscall igl::viewer::OpenGL_state::bind_mesh(void)" (?bind_mesh@OpenGL_state@viewer@igl@@QAEXXZ)
main.cpp.obj : error LNK2019: unresolved external symbol __imp__glBlendFunc@8 referenced in function "public: void __thiscall igl::viewer::ViewerCore::draw(class igl::viewer::ViewerData &,class igl::viewer::OpenGL_state &,bool)" (?draw@ViewerCore@viewer@igl@@QAEXAAVViewerData@23@AAVOpenGL_state@23@_N@Z)
main.cpp.obj : error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function "public: void __thiscall igl::viewer::ViewerCore::clear_framebuffers(void)" (?clear_framebuffers@ViewerCore@viewer@igl@@QAEXXZ)
main.cpp.obj : error LNK2019: unresolved external symbol __imp__glClearColor@16 referenced in function "public: void __thiscall igl::viewer::ViewerCore::clear_framebuffers(void)" (?clear_framebuffers@ViewerCore@viewer@igl@@QAEXXZ)
main.cpp.obj : error LNK2019: unresolved external symbol __imp__glDeleteTextures@8 referenced in function "public: void __thiscall igl::viewer::OpenGL_state::free_buffers(void)" (?free_buffers@OpenGL_state@viewer@igl@@QAEXXZ)
main.cpp.obj : error LNK2019: unresolved external symbol __imp__glDisable@4 referenced in function "public: void __thiscall igl::viewer::ViewerCore::draw(class igl::viewer::ViewerData &,class igl::viewer::OpenGL_state &,bool)" (?draw@ViewerCore@viewer@igl@@QAEXAAVViewerData@23@AAVOpenGL_state@23@_N@Z)
main.cpp.obj : error LNK2019: unresolved external symbol __imp__glDrawElements@16 referenced in function "public: void __thiscall igl::viewer::OpenGL_state::draw_mesh(bool)" (?draw_mesh@OpenGL_state@viewer@igl@@QAEX_N@Z)
main.cpp.obj : error LNK2019: unresolved external symbol __imp__glEnable@4 referenced in function "public: void __thiscall igl::viewer::ViewerCore::draw(class igl::viewer::ViewerData &,class igl::viewer::OpenGL_state &,bool)" (?draw@ViewerCore@viewer@igl@@QAEXAAVViewerData@23@AAVOpenGL_state@23@_N@Z)
main.cpp.obj : error LNK2019: unresolved external symbol __imp__glGenTextures@8 referenced in function "public: void __thiscall igl::viewer::OpenGL_state::init_buffers(void)" (?init_buffers@OpenGL_state@viewer@igl@@QAEXXZ)
main.cpp.obj : error LNK2019: unresolved external symbol __imp__glGetError@0 referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol __imp__glGetString@4 referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol __imp__glLineWidth@4 referenced in function "public: void __thiscall igl::viewer::ViewerCore::draw(class igl::viewer::ViewerData &,class igl::viewer::OpenGL_state &,bool)" (?draw@ViewerCore@viewer@igl@@QAEXAAVViewerData@23@AAVOpenGL_state@23@_N@Z)
main.cpp.obj : error LNK2019: unresolved external symbol __imp__glPixelStorei@8 referenced in function "public: void __thiscall igl::viewer::OpenGL_state::bind_mesh(void)" (?bind_mesh@OpenGL_state@viewer@igl@@QAEXXZ)
main.cpp.obj : error LNK2019: unresolved external symbol __imp__glPointSize@4 referenced in function "public: void __thiscall igl::viewer::ViewerCore::draw(class igl::viewer::ViewerData &,class igl::viewer::OpenGL_state &,bool)" (?draw@ViewerCore@viewer@igl@@QAEXAAVViewerData@23@AAVOpenGL_state@23@_N@Z)
main.cpp.obj : error LNK2019: unresolved external symbol __imp__glPolygonMode@8 referenced in function "public: void __thiscall igl::viewer::OpenGL_state::draw_mesh(bool)" (?draw_mesh@OpenGL_state@viewer@igl@@QAEX_N@Z)
main.cpp.obj : error LNK2019: unresolved external symbol __imp__glPolygonOffset@8 referenced in function "public: void __thiscall igl::viewer::OpenGL_state::draw_mesh(bool)" (?draw_mesh@OpenGL_state@viewer@igl@@QAEX_N@Z)
main.cpp.obj : error LNK2019: unresolved external symbol __imp__glTexImage2D@36 referenced in function "public: void __thiscall igl::viewer::OpenGL_state::bind_mesh(void)" (?bind_mesh@OpenGL_state@viewer@igl@@QAEXXZ)
main.cpp.obj : error LNK2019: unresolved external symbol __imp__glTexParameteri@12 referenced in function "public: void __thiscall igl::viewer::OpenGL_state::bind_mesh(void)" (?bind_mesh@OpenGL_state@viewer@igl@@QAEXXZ)
main.cpp.obj : error LNK2019: unresolved external symbol __imp__glViewport@16 referenced in function "public: void __thiscall igl::viewer::ViewerCore::draw(class igl::viewer::ViewerData &,class igl::viewer::OpenGL_state &,bool)" (?draw@ViewerCore@viewer@igl@@QAEXAAVViewerData@23@AAVOpenGL_state@23@_N@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glewInit@0 referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glewGetErrorString@4 referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glewGetString@4 referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwInit referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwTerminate referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwSetErrorCallback referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwGetPrimaryMonitor referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwGetVideoMode referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwWindowHint referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwCreateWindow referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwDestroyWindow referenced in function "public: void __thiscall igl::viewer::Viewer::launch_shut(void)" (?launch_shut@Viewer@viewer@igl@@QAEXXZ)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwWindowShouldClose referenced in function "public: bool __thiscall igl::viewer::Viewer::launch_rendering(bool)" (?launch_rendering@Viewer@viewer@igl@@QAE_N_N@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwSetWindowShouldClose referenced in function "void __cdecl glfw_key_callback(struct GLFWwindow *,int,int,int,int)" (?glfw_key_callback@@YAXPAUGLFWwindow@@HHHH@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwGetWindowSize referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwGetFramebufferSize referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwGetWindowAttrib referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwSetWindowSizeCallback referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwPollEvents referenced in function "public: bool __thiscall igl::viewer::Viewer::launch_rendering(bool)" (?launch_rendering@Viewer@viewer@igl@@QAE_N_N@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwWaitEvents referenced in function "public: bool __thiscall igl::viewer::Viewer::launch_rendering(bool)" (?launch_rendering@Viewer@viewer@igl@@QAE_N_N@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwSetInputMode referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwSetKeyCallback referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwSetCharModsCallback referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwSetMouseButtonCallback referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwSetCursorPosCallback referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwSetScrollCallback referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwSetDropCallback referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwMakeContextCurrent referenced in function "public: int __thiscall igl::viewer::Viewer::launch_init(bool,bool)" (?launch_init@Viewer@viewer@igl@@QAEH_N0@Z)
main.cpp.obj : error LNK2019: unresolved external symbol _glfwSwapBuffers referenced in function "public: bool __thiscall igl::viewer::Viewer::launch_rendering(bool)" (?launch_rendering@Viewer@viewer@igl@@QAE_N_N@Z)
main.cpp.obj : error LNK2001: unresolved external symbol ___glewActiveTexture
main.cpp.obj : error LNK2001: unresolved external symbol ___glewBindBuffer
main.cpp.obj : error LNK2001: unresolved external symbol ___glewBufferData
main.cpp.obj : error LNK2001: unresolved external symbol ___glewDeleteBuffers
main.cpp.obj : error LNK2001: unresolved external symbol ___glewGenBuffers
main.cpp.obj : error LNK2001: unresolved external symbol ___glewAttachShader
main.cpp.obj : error LNK2001: unresolved external symbol ___glewCompileShader
main.cpp.obj : error LNK2001: unresolved external symbol ___glewCreateProgram
main.cpp.obj : error LNK2001: unresolved external symbol ___glewCreateShader
main.cpp.obj : error LNK2001: unresolved external symbol ___glewDeleteProgram
main.cpp.obj : error LNK2001: unresolved external symbol ___glewDeleteShader
main.cpp.obj : error LNK2001: unresolved external symbol ___glewDisableVertexAttribArray
main.cpp.obj : error LNK2001: unresolved external symbol ___glewEnableVertexAttribArray
main.cpp.obj : error LNK2001: unresolved external symbol ___glewGetAttribLocation
main.cpp.obj : error LNK2001: unresolved external symbol ___glewGetProgramInfoLog
main.cpp.obj : error LNK2001: unresolved external symbol ___glewGetProgramiv
main.cpp.obj : error LNK2001: unresolved external symbol ___glewGetShaderInfoLog
main.cpp.obj : error LNK2001: unresolved external symbol ___glewGetShaderiv
main.cpp.obj : error LNK2001: unresolved external symbol ___glewGetUniformLocation
main.cpp.obj : error LNK2001: unresolved external symbol ___glewLinkProgram
main.cpp.obj : error LNK2001: unresolved external symbol ___glewShaderSource
main.cpp.obj : error LNK2001: unresolved external symbol ___glewUniform1f
main.cpp.obj : error LNK2001: unresolved external symbol ___glewUniform1i
main.cpp.obj : error LNK2001: unresolved external symbol ___glewUniform3fv
main.cpp.obj : error LNK2001: unresolved external symbol ___glewUniform4f
main.cpp.obj : error LNK2001: unresolved external symbol ___glewUniformMatrix4fv
main.cpp.obj : error LNK2001: unresolved external symbol ___glewUseProgram
main.cpp.obj : error LNK2001: unresolved external symbol ___glewVertexAttribPointer
main.cpp.obj : error LNK2001: unresolved external symbol ___glewBindFragDataLocation
main.cpp.obj : error LNK2001: unresolved external symbol ___glewProgramParameteri
main.cpp.obj : error LNK2001: unresolved external symbol ___glewBindVertexArray
main.cpp.obj : error LNK2001: unresolved external symbol ___glewDeleteVertexArrays
main.cpp.obj : error LNK2001: unresolved external symbol ___glewGenVertexArrays
main.cpp.obj : error LNK2001: unresolved external symbol _glewExperimental
Lab1.exe : fatal error LNK1120: 81 unresolved externals
LINK Pass 1 failed. with 1120
NMAKE : fatal error U1077: '"D:\Actual Program Files\JetBrains\CLion 2017.3.1\bin\cmake\bin\cmake.exe"' : return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"D:\Actual Program Files\Visual Studio 2015\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"D:\Actual Program Files\Visual Studio 2015\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"D:\Actual Program Files\Visual Studio 2015\VC\BIN\nmake.exe"' : return code '0x2'
Stop.

Спасибо за помощь.


РЕДАКТИРОВАТЬ:
Цыварев помог мне с очевидными ошибками. Все тоже поменял на 32-битные. До 47 неразрешенных внешних. Обновлю, как только он заработает.
Текущий Cmake:

cmake_minimum_required(VERSION 3.9)
project(Lab1)

set(CMAKE_VERBOSE_MAKEFILE ON)

set(CMAKE_CXX_STANDARD 17)

link_libraries(../external/glew_2_1_0/lib/Release/Win32/glew32s)add_executable(Lab1 main.cpp)include_directories(external/libigl/include)
include_directories(external/glfw/include/)
include_directories(external/eigen-git-mirror/)

include_directories(external/glew_2_1_0/include)

РЕДАКТИРОВАТЬ: РЕШИТЬ Все работает! Не хватало некоторых библиотек. Решил связать их локально. Вот cmake для следующей души, которая сталкивается с этим:

cmake_minimum_required(VERSION 3.9)
project(Lab1)

set(CMAKE_VERBOSE_MAKEFILE ON)

set(CMAKE_CXX_STANDARD 17)

link_libraries(../external/glew_2_1_0/lib/Release/Win32/glew32s)
link_libraries(../external/glfw/lib-vc2015/glfw3)

link_libraries(../external/openGL/OPENGL32)
link_libraries(../external/openGL/glut32)
link_libraries(../external/openGL/glu32)

find_package(OpenGL REQUIRED)
include_directories( ${OPENGL_INCLUDE_DIRS})
#target_link_libraries(${PROJECTNAME} ${OPENGL_LIBRARIES})add_executable(Lab1 main.cpp)include_directories(external/libigl/include)
include_directories(external/glfw/include/)
include_directories(external/eigen-git-mirror/)

include_directories(external/glew_2_1_0/include)

Спасибо за помощь!

0

Решение

команда link_libraries влияет только на дальнейшие цели, поэтому его следует выдавать до add_executable вызов.


Также, link_libraries принимает библиотеку файлы, не каталог с ними.

0

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]