Howdy!
I can compile but not link the ImGui example currently (Windows, VS2019). I get linker errors regarding the event handlers in Context:
main.cpp.obj : error LNK2019: unresolved external symbol "public: void __cdecl Magnum::ImGuiIntegration::Context::updateApplicationCursor<class Kpns::UI::MainWindow>(class Kpns::UI::MainWindow &)" (??$updateApplicationCursor@VMainWindow@UI@Kpns@@@Context@ImGuiIntegration@Magnum@@QEAAXAEAVMainWindow@UI@Kpns@@@Z) referenced in function "private: virtual void __cdecl Kpns::UI::MainWindow::drawEvent(void)" (?drawEvent@MainWindow@UI@Kpns@@EEAAXXZ)
main.cpp.obj : error LNK2019: unresolved external symbol "public: bool __cdecl Magnum::ImGuiIntegration::Context::handleKeyPressEvent<class Magnum::Platform::GlfwApplication::KeyEvent>(class Magnum::Platform::GlfwApplication::KeyEvent &)" (??$handleKeyPressEvent@VKeyEvent@GlfwApplication@Platform@Magnum@@@Context@ImGuiIntegration@Magnum@@QEAA_NAEAVKeyEvent@GlfwApplication@Platform@2@@Z) referenced in function "private: virtual void __cdecl Kpns::UI::MainWindow::keyPressEvent(class Magnum::Platform::GlfwApplication::KeyEvent &)" (?keyPressEvent@MainWindow@UI@Kpns@@EEAAXAEAVKeyEvent@GlfwApplication@Platform@Magnum@@@Z)
main.cpp.obj : error LNK2019: unresolved external symbol "public: bool __cdecl Magnum::ImGuiIntegration::Context::handleKeyReleaseEvent<class Magnum::Platform::GlfwApplication::KeyEvent>(class Magnum::Platform::GlfwApplication::KeyEvent &)" (??$handleKeyReleaseEvent@VKeyEvent@GlfwApplication@Platform@Magnum@@@Context@ImGuiIntegration@Magnum@@QEAA_NAEAVKeyEvent@GlfwApplication@Platform@2@@Z) referenced in function "private: virtual void __cdecl Kpns::UI::MainWindow::keyReleaseEvent(class Magnum::Platform::GlfwApplication::KeyEvent &)" (?keyReleaseEvent@MainWindow@UI@Kpns@@EEAAXAEAVKeyEvent@GlfwApplication@Platform@Magnum@@@Z)
main.cpp.obj : error LNK2019: unresolved external symbol "public: bool __cdecl Magnum::ImGuiIntegration::Context::handleMousePressEvent<class Magnum::Platform::GlfwApplication::MouseEvent>(class Magnum::Platform::GlfwApplication::MouseEvent &)" (??$handleMousePressEvent@VMouseEvent@GlfwApplication@Platform@Magnum@@@Context@ImGuiIntegration@Magnum@@QEAA_NAEAVMouseEvent@GlfwApplication@Platform@2@@Z) referenced in function "private: virtual void __cdecl Kpns::UI::MainWindow::mousePressEvent(class Magnum::Platform::GlfwApplication::MouseEvent &)" (?mousePressEvent@MainWindow@UI@Kpns@@EEAAXAEAVMouseEvent@GlfwApplication@Platform@Magnum@@@Z)
main.cpp.obj : error LNK2019: unresolved external symbol "public: bool __cdecl Magnum::ImGuiIntegration::Context::handleMouseReleaseEvent<class Magnum::Platform::GlfwApplication::MouseEvent>(class Magnum::Platform::GlfwApplication::MouseEvent &)" (??$handleMouseReleaseEvent@VMouseEvent@GlfwApplication@Platform@Magnum@@@Context@ImGuiIntegration@Magnum@@QEAA_NAEAVMouseEvent@GlfwApplication@Platform@2@@Z) referenced in function "private: virtual void __cdecl Kpns::UI::MainWindow::mouseReleaseEvent(class Magnum::Platform::GlfwApplication::MouseEvent &)" (?mouseReleaseEvent@MainWindow@UI@Kpns@@EEAAXAEAVMouseEvent@GlfwApplication@Platform@Magnum@@@Z)
main.cpp.obj : error LNK2019: unresolved external symbol "public: bool __cdecl Magnum::ImGuiIntegration::Context::handleMouseMoveEvent<class Magnum::Platform::GlfwApplication::MouseMoveEvent>(class Magnum::Platform::GlfwApplication::MouseMoveEvent &)" (??$handleMouseMoveEvent@VMouseMoveEvent@GlfwApplication@Platform@Magnum@@@Context@ImGuiIntegration@Magnum@@QEAA_NAEAVMouseMoveEvent@GlfwApplication@Platform@2@@Z) referenced in function "private: virtual void __cdecl Kpns::UI::MainWindow::mouseMoveEvent(class Magnum::Platform::GlfwApplication::MouseMoveEvent &)" (?mouseMoveEvent@MainWindow@UI@Kpns@@EEAAXAEAVMouseMoveEvent@GlfwApplication@Platform@Magnum@@@Z)
main.cpp.obj : error LNK2019: unresolved external symbol "public: bool __cdecl Magnum::ImGuiIntegration::Context::handleMouseScrollEvent<class Magnum::Platform::GlfwApplication::MouseScrollEvent>(class Magnum::Platform::GlfwApplication::MouseScrollEvent &)" (??$handleMouseScrollEvent@VMouseScrollEvent@GlfwApplication@Platform@Magnum@@@Context@ImGuiIntegration@Magnum@@QEAA_NAEAVMouseScrollEvent@GlfwApplication@Platform@2@@Z) referenced in function "private: virtual void __cdecl Kpns::UI::MainWindow::mouseScrollEvent(class Magnum::Platform::GlfwApplication::MouseScrollEvent &)" (?mouseScrollEvent@MainWindow@UI@Kpns@@EEAAXAEAVMouseScrollEvent@GlfwApplication@Platform@Magnum@@@Z)
main.cpp.obj : error LNK2019: unresolved external symbol "public: bool __cdecl Magnum::ImGuiIntegration::Context::handleTextInputEvent<class Magnum::Platform::GlfwApplication::TextInputEvent>(class Magnum::Platform::GlfwApplication::TextInputEvent &)" (??$handleTextInputEvent@VTextInputEvent@GlfwApplication@Platform@Magnum@@@Context@ImGuiIntegration@Magnum@@QEAA_NAEAVTextInputEvent@GlfwApplication@Platform@2@@Z) referenced in function "private: virtual void __cdecl Kpns::UI::MainWindow::textInputEvent(class Magnum::Platform::GlfwApplication::TextInputEvent &)" (?textInputEvent@MainWindow@UI@Kpns@@EEAAXAEAVTextInputEvent@GlfwApplication@Platform@Magnum@@@Z)
My relevant CMake script that sets up Magnum:
##############################################################################
# Magnum (and it's associated subprojects)
#
set(BUILD_STATIC ON CACHE BOOL "" FORCE)
set(WITH_TESTSUITE OFF CACHE BOOL "" FORCE)
add_subdirectory(source/corrade EXCLUDE_FROM_ALL)
set(WITH_AUDIO OFF CACHE BOOL "" FORCE)
set(WITH_GLFWAPPLICATION ON CACHE BOOL "" FORCE)
add_subdirectory(source/magnum EXCLUDE_FROM_ALL)
set(WITH_EIGEN ON CACHE BOOL "" FORCE)
set(WITH_IMGUI ON CACHE BOOL "" FORCE)
set(IMGUI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source/imgui)
add_subdirectory(source/magnum-integration EXCLUDE_FROM_ALL)
set(WITH_PNGIMAGECONVERTER ON CACHE BOOL "" FORCE)
set(WITH_PNGIMPORTER ON CACHE BOOL "" FORCE)
add_subdirectory(source/magnum-plugins EXCLUDE_FROM_ALL)
And because I set this all up from a subdirectory under the repo root I provide a global interface library to avoid having to repeat myself for anything that uses Magnum:
add_library(kpns_graphics INTERFACE)
target_link_libraries(kpns_graphics INTERFACE
Corrade::Main
Magnum::GlfwApplication
Magnum::GL
Magnum::Magnum
Magnum::Shaders
Magnum::SceneGraph
Magnum::DebugTools
Magnum::Primitives
Magnum::Text
Magnum::TextureTools
Magnum::Trade
MagnumIntegration::ImGui
MagnumIntegration::Eigen
)
My application adds kpns_graphics to it's PRIVATE target_link_libraries.
So, everything compiles fine, CLion resolves all symbols etc. But when linking it fails and I'm not sure why. I'd appreciate any helpful advice.
Thanks!
Howdy!
I can compile but not link the ImGui example currently (Windows, VS2019). I get linker errors regarding the event handlers in Context:
My relevant CMake script that sets up Magnum:
And because I set this all up from a subdirectory under the repo root I provide a global interface library to avoid having to repeat myself for anything that uses Magnum:
My application adds
kpns_graphicsto it's PRIVATE target_link_libraries.So, everything compiles fine, CLion resolves all symbols etc. But when linking it fails and I'm not sure why. I'd appreciate any helpful advice.
Thanks!