如何解决带有glfw的opengl无法与imgui c ++链接
我正在学习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函数都在我的应用程序中运行。cpp仅在我将imgui文件添加到项目时才会中断。
解决方法
问题不是 imgui,而是 lib glfw 和 glew。所以看起来你没有链接库
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。