Hello,
I am trying to integrate Dear ImGui into an application using GLFW + OpenGL3, but get a linking error (LINK2019) with the following message:
Viewer.obj : error LNK2019: unresolved external symbol “bool __cdecl ImGui_ImplGlfw_InitForOpenGL(class GLFWwindow *,bool)” (?ImGui_ImplGlfw_InitForOpenGLYA_NPEAVGLFWwindow_NZ) referenced in function “public: void __cdecl Viewer::run(void)” (?runViewerQEAAXXZ)
I’ve got my includes for “imgui.h”, “imgui_impl_glfw.h”, and “imgui_impl_opengl3.h” at the top of the file (in that order) so I’m at a loss as to what is going wrong here.
The issue was that GLFWwindow is defined as a struct in imgui_impl_glfw.h, but is defined as a class in the rest of the app. Changing struct to class in imgui_impl_glfw.h allows the solution to compile and run.
Yeah, I am certain: I could compile and link while using functions defined in imgui_impl_glfw.cpp as long as I wasn’t using ImGui_ImplGlfw_InitForOpenGL (obviously it would crash as I’d start it since I didn’t init). I guess the compiler just didn’t consider ImGui_ImplGlfw_InitForOpenGL(struct GLFWindow *,bool) equal to ImGui_ImplGlfw_InitForOpenGL(class GLFWindow *,bool).