【问题标题】:opengl with glfw not linking with imgui c++ [duplicate]带有glfw的opengl没有与imgui c ++链接[重复]
【发布时间】:2020-08-29 12:47:13
【问题描述】:

我正在学习 opengl,并决定通过在项目中添加以下文件来将 imgui 用于现有的 opengl cmake 项目:

target_sources(Application PRIVATE
vendor/include/imgui/imgui.cpp
vendor/include/imgui/imgui_draw.cpp
vendor/include/imgui/imgui_impl_glfw.cpp
vendor/include/imgui/imgui_impl_opengl3.cpp
vendor/include/imgui/imgui_widgets.cpp
vendor/glad/glad.c
vendor/include/stb_image/stb_image.c
src/Indexbuffer.cpp
src/Shader.cpp
src/Texture.cpp
src/Vertexarray.cpp
src/Vertexbuffer.cpp
)

虽然这在 Windows 上运行良好,但是当我在 linux 中构建它时,链接器显示错误提示:

in function `ImGui_ImplOpenGL3_Init(char const*)':
imgui_impl_opengl3.cpp:148: undefined reference to `glGetIntegerv'
imgui_impl_opengl3.cpp:230: undefined reference to `glEnable'
imgui_impl_opengl3.cpp:231: undefined reference to `__glewBlendEquation'

所有其他 glfw 和 opengl 函数都在我的 application.cpp 中工作,只有在我将 imgui 文件添加到项目时才会中断。

【问题讨论】:

    标签: c++ opengl imgui


    【解决方案1】:

    问题不是 imgui,而是 lib glfw 和 glew。所以看来你还没有链接库

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-14
      • 2021-11-13
      • 2016-10-14
      • 1970-01-01
      • 1970-01-01
      • 2013-01-21
      相关资源
      最近更新 更多