Error Linking ImGui_ImplGlfw_InitForOpenGL

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.

Thank you,
Charles

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.

Are you sure this was the issue?

I would say the issue seemingly was that you didn’t compile and link imgui_impl_glfw.cpp and imgui_impl_glfw.cpp in your project?

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).

Which compiler, version, and OS ?

is defined as a class in the rest of the app.

Where would that be?
GLFWwindow is never defined as a class in glfw source code, so perhaps “the rest of the app” is the culprit there?

Sorry for the confusion: by “rest of the app”, I am referring to the app that I was integrating Dear ImGui into.

So it looks like your fix should be in your app, NOT in imgui_impl_glfw.h ?