由于未定义对符号“dlclose@@GLIBC_2.2.5”的引用,无法构建 imgui 应用程序

发布于 2025-01-16 01:22:03 字数 1456 浏览 0 评论 0原文

我正在尝试使用 Dear ImGui 构建非常简单的应用程序。

我将一些 Dear ImGui 文件复制到我的源目录中,并使用 CMake 进行编译,如下所示。

cmake_minimum_required(VERSION 3.12)
project(imgui)

find_package(GLEW REQUIRED)
find_package(glfw3 REQUIRED)
find_package(OpenGL REQUIRED)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

add_executable(min 
    min.cpp
    ${CMAKE_SOURCE_DIR}/imgui.cpp
    ${CMAKE_SOURCE_DIR}/imgui_demo.cpp
    ${CMAKE_SOURCE_DIR}/imgui_draw.cpp
    ${CMAKE_SOURCE_DIR}/imgui_tables.cpp
    ${CMAKE_SOURCE_DIR}/imgui_widgets.cpp
    ${CMAKE_SOURCE_DIR}/imgui_impl_opengl3.cpp
    ${CMAKE_SOURCE_DIR}/imgui_impl_glfw.cpp
    )



target_link_libraries(min
    glfw
    GLEW 
    GL
    #${CMAKE_DL_LIBS} <If this command is used, build successfully!>
    )

但我收到以下错误。

-- Configuring done
-- Generating done
-- Build files have been written to: /home/harumo/program/cpp/imgui/minimal/build
[ 11%] Linking CXX executable min
/usr/bin/ld: CMakeFiles/min.dir/imgui_impl_opengl3.cpp.o: undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
/usr/bin/ld: /lib/x86_64-linux-gnu/libdl.so.2: error adding symbols: DSO missing from command line
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [CMakeFiles/min.dir/build.make:189: min] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/min.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

如果您需要任何其他信息,请告诉我。

提前致谢!

I am trying to build very simple application with Dear ImGui.

I copied some Dear ImGui files to my source directory and I compiled with CMake as follows.

cmake_minimum_required(VERSION 3.12)
project(imgui)

find_package(GLEW REQUIRED)
find_package(glfw3 REQUIRED)
find_package(OpenGL REQUIRED)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

add_executable(min 
    min.cpp
    ${CMAKE_SOURCE_DIR}/imgui.cpp
    ${CMAKE_SOURCE_DIR}/imgui_demo.cpp
    ${CMAKE_SOURCE_DIR}/imgui_draw.cpp
    ${CMAKE_SOURCE_DIR}/imgui_tables.cpp
    ${CMAKE_SOURCE_DIR}/imgui_widgets.cpp
    ${CMAKE_SOURCE_DIR}/imgui_impl_opengl3.cpp
    ${CMAKE_SOURCE_DIR}/imgui_impl_glfw.cpp
    )



target_link_libraries(min
    glfw
    GLEW 
    GL
    #${CMAKE_DL_LIBS} <If this command is used, build successfully!>
    )

But I got following error.

-- Configuring done
-- Generating done
-- Build files have been written to: /home/harumo/program/cpp/imgui/minimal/build
[ 11%] Linking CXX executable min
/usr/bin/ld: CMakeFiles/min.dir/imgui_impl_opengl3.cpp.o: undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
/usr/bin/ld: /lib/x86_64-linux-gnu/libdl.so.2: error adding symbols: DSO missing from command line
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [CMakeFiles/min.dir/build.make:189: min] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/min.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

If you have any other information you need, please let me know.

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文