I am trying to create a menu for my Vulkan app using GLFW and ImGui. The problem is that I am getting “error LNK2019: unresolved external symbol” all over the place and I don’t understand what I am doing wrong.
For now I am only trying to run the code from here: https://github.com/ocornut/imgui/blob/master/examples/example_glfw_vulkan/main.cpp
And what I get when running it is:
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>main.obj : error LNK2019: unresolved external symbol "struct ImGuiContext * __cdecl ImGui::CreateContext(struct ImFontAtlas *)" (?CreateContext@ImGui@@YAPEAUImGuiContext@@PEAUImFontAtlas@@@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl ImGui::DestroyContext(struct ImGuiContext *)" (?DestroyContext@ImGui@@YAXPEAUImGuiContext@@@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "struct ImGuiIO & __cdecl ImGui::GetIO(void)" (?GetIO@ImGui@@YAAEAUImGuiIO@@XZ) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl ImGui::NewFrame(void)" (?NewFrame@ImGui@@YAXXZ) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl ImGui::Render(void)" (?Render@ImGui@@YAXXZ) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "struct ImDrawData * __cdecl ImGui::GetDrawData(void)" (?GetDrawData@ImGui@@YAPEAUImDrawData@@XZ) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl ImGui::ShowDemoWindow(bool *)" (?ShowDemoWindow@ImGui@@YAXPEA_N@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl ImGui::StyleColorsDark(struct ImGuiStyle *)" (?StyleColorsDark@ImGui@@YAXPEAUImGuiStyle@@@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "bool __cdecl ImGui::Begin(char const *,bool *,int)" (?Begin@ImGui@@YA_NPEBDPEA_NH@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl ImGui::End(void)" (?End@ImGui@@YAXXZ) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl ImGui::SameLine(float,float)" (?SameLine@ImGui@@YAXMM@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl ImGui::Text(char const *,...)" (?Text@ImGui@@YAXPEBDZZ) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "bool __cdecl ImGui::Button(char const *,struct ImVec2 const &)" (?Button@ImGui@@YA_NPEBDAEBUImVec2@@@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "bool __cdecl ImGui::Checkbox(char const *,bool *)" (?Checkbox@ImGui@@YA_NPEBDPEA_N@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "bool __cdecl ImGui::SliderFloat(char const *,float *,float,float,char const *,int)" (?SliderFloat@ImGui@@YA_NPEBDPEAMMM0H@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "bool __cdecl ImGui::ColorEdit3(char const *,float * const,int)" (?ColorEdit3@ImGui@@YA_NPEBDQEAMH@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "bool __cdecl ImGui::DebugCheckVersionAndDataLayout(char const *,unsigned __int64,unsigned __int64,unsigned __int64,unsigned __int64,unsigned __int64,unsigned __int64)" (?DebugCheckVersionAndDataLayout@ImGui@@YA_NPEBD_K11111@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "void * __cdecl ImGui::MemAlloc(unsigned __int64)" (?MemAlloc@ImGui@@YAPEAX_K@Z) referenced in function "public: void __cdecl ImVector<struct VkPhysicalDevice_T *>::reserve(int)" (?reserve@?$ImVector@PEAUVkPhysicalDevice_T@@@@QEAAXH@Z)
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl ImGui::MemFree(void *)" (?MemFree@ImGui@@YAXPEAX@Z) referenced in function "public: __cdecl ImVector<struct VkPhysicalDevice_T *>::~ImVector<struct VkPhysicalDevice_T *>(void)" (??1?$ImVector@PEAUVkPhysicalDevice_T@@@@QEAA@XZ)
1>main.obj : error LNK2019: unresolved external symbol "bool __cdecl ImGui_ImplGlfw_InitForVulkan(struct GLFWwindow *,bool)" (?ImGui_ImplGlfw_InitForVulkan@@YA_NPEAUGLFWwindow@@_N@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl ImGui_ImplGlfw_Shutdown(void)" (?ImGui_ImplGlfw_Shutdown@@YAXXZ) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl ImGui_ImplGlfw_NewFrame(void)" (?ImGui_ImplGlfw_NewFrame@@YAXXZ) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl ImGui_ImplGlfw_Sleep(int)" (?ImGui_ImplGlfw_Sleep@@YAXH@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "bool __cdecl ImGui_ImplVulkan_Init(struct ImGui_ImplVulkan_InitInfo *)" (?ImGui_ImplVulkan_Init@@YA_NPEAUImGui_ImplVulkan_InitInfo@@@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl ImGui_ImplVulkan_Shutdown(void)" (?ImGui_ImplVulkan_Shutdown@@YAXXZ) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl ImGui_ImplVulkan_NewFrame(void)" (?ImGui_ImplVulkan_NewFrame@@YAXXZ) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl ImGui_ImplVulkan_RenderDrawData(struct ImDrawData *,struct VkCommandBuffer_T *,struct VkPipeline_T *)" (?ImGui_ImplVulkan_RenderDrawData@@YAXPEAUImDrawData@@PEAUVkCommandBuffer_T@@PEAUVkPipeline_T@@@Z) referenced in function "void __cdecl FrameRender(struct ImGui_ImplVulkanH_Window *,struct ImDrawData *)" (?FrameRender@@YAXPEAUImGui_ImplVulkanH_Window@@PEAUImDrawData@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl ImGui_ImplVulkan_SetMinImageCount(unsigned int)" (?ImGui_ImplVulkan_SetMinImageCount@@YAXI@Z) referenced in function main
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl ImGui_ImplVulkanH_CreateOrResizeWindow(struct VkInstance_T *,struct VkPhysicalDevice_T *,struct VkDevice_T *,struct ImGui_ImplVulkanH_Window *,unsigned int,struct VkAllocationCallbacks const *,int,int,unsigned int)" (?ImGui_ImplVulkanH_CreateOrResizeWindow@@YAXPEAUVkInstance_T@@PEAUVkPhysicalDevice_T@@PEAUVkDevice_T@@PEAUImGui_ImplVulkanH_Window@@IPEBUVkAllocationCallbacks@@HHI@Z) referenced in function "void __cdecl SetupVulkanWindow(struct ImGui_ImplVulkanH_Window *,struct VkSurfaceKHR_T *,int,int)" (?SetupVulkanWindow@@YAXPEAUImGui_ImplVulkanH_Window@@PEAUVkSurfaceKHR_T@@HH@Z)
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl ImGui_ImplVulkanH_DestroyWindow(struct VkInstance_T *,struct VkDevice_T *,struct ImGui_ImplVulkanH_Window *,struct VkAllocationCallbacks const *)" (?ImGui_ImplVulkanH_DestroyWindow@@YAXPEAUVkInstance_T@@PEAUVkDevice_T@@PEAUImGui_ImplVulkanH_Window@@PEBUVkAllocationCallbacks@@@Z) referenced in function "void __cdecl CleanupVulkanWindow(void)" (?CleanupVulkanWindow@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "struct VkSurfaceFormatKHR __cdecl ImGui_ImplVulkanH_SelectSurfaceFormat(struct VkPhysicalDevice_T *,struct VkSurfaceKHR_T *,enum VkFormat const *,int,enum VkColorSpaceKHR)" (?ImGui_ImplVulkanH_SelectSurfaceFormat@@YA?AUVkSurfaceFormatKHR@@PEAUVkPhysicalDevice_T@@PEAUVkSurfaceKHR_T@@PEBW4VkFormat@@HW4VkColorSpaceKHR@@@Z) referenced in function "void __cdecl SetupVulkanWindow(struct ImGui_ImplVulkanH_Window *,struct VkSurfaceKHR_T *,int,int)" (?SetupVulkanWindow@@YAXPEAUImGui_ImplVulkanH_Window@@PEAUVkSurfaceKHR_T@@HH@Z)
1>main.obj : error LNK2019: unresolved external symbol "enum VkPresentModeKHR __cdecl ImGui_ImplVulkanH_SelectPresentMode(struct VkPhysicalDevice_T *,struct VkSurfaceKHR_T *,enum VkPresentModeKHR const *,int)" (?ImGui_ImplVulkanH_SelectPresentMode@@YA?AW4VkPresentModeKHR@@PEAUVkPhysicalDevice_T@@PEAUVkSurfaceKHR_T@@PEBW41@H@Z) referenced in function "void __cdecl SetupVulkanWindow(struct ImGui_ImplVulkanH_Window *,struct VkSurfaceKHR_T *,int,int)" (?SetupVulkanWindow@@YAXPEAUImGui_ImplVulkanH_Window@@PEAUVkSurfaceKHR_T@@HH@Z)
This is my dependency folder structure:
I will add the picture with my settings, maybe it helps..
9