簡體   English   中英

在Debug配置中進行編譯可以正常工作,但是Release會給出鏈接錯誤

[英]Compiling in Debug configuration works fine, but Release gives link errors

我在Visual Studio 2017中使用GLFW( glfw3.lib而不是glfw3dll.lib )和GLAD( glad.c )。在Debug配置中編譯可以正常工作,而Release版本會拋出奇怪的鏈接器錯誤。 這些是“無法解析的外部符號”:

1>glad.obj : error LNK2001: unresolved external symbol __security_check_cookie
1>glad.obj : error LNK2001: unresolved external symbol __imp_realloc
1>glad.obj : error LNK2001: unresolved external symbol __imp_strncmp
1>glad.obj : error LNK2001: unresolved external symbol __imp_free
1>glad.obj : error LNK2001: unresolved external symbol strstr
1>glad.obj : error LNK2001: unresolved external symbol __imp___stdio_common_vsscanf
1>glad.obj : error LNK2001: unresolved external symbol __imp_malloc
1>Game.obj : error LNK2001: unresolved external symbol __CxxFrameHandler3
1>Game.obj : error LNK2001: unresolved external symbol glfwSwapBuffers
1>Game.obj : error LNK2001: unresolved external symbol __imp_exit
1>Game.obj : error LNK2001: unresolved external symbol glfwGetKey
1>Game.obj : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned __int64)" (??2@YAPEAX_K@Z)
1>Game.obj : error LNK2001: unresolved external symbol glfwTerminate
1>Game.obj : error LNK2001: unresolved external symbol glfwPollEvents
1>Game.obj : error LNK2001: unresolved external symbol glfwInit
1>Game.obj : error LNK2001: unresolved external symbol glfwSetWindowShouldClose
1>Game.obj : error LNK2001: unresolved external symbol glfwCreateWindow
1>Game.obj : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *,unsigned __int64)" (??3@YAXPEAX_K@Z)
1>Game.obj : error LNK2001: unresolved external symbol glfwWindowHint
1>Game.obj : error LNK2001: unresolved external symbol glfwMakeContextCurrent
1>Game.obj : error LNK2001: unresolved external symbol glfwSetWindowTitle
1>Game.obj : error LNK2001: unresolved external symbol glfwGetProcAddress
1>Game.obj : error LNK2001: unresolved external symbol __std_terminate
1>Game.obj : error LNK2001: unresolved external symbol glfwWindowShouldClose
1>Game.obj : error LNK2001: unresolved external symbol __imp__invalid_parameter_noinfo_noreturn
1>Game.obj : error LNK2001: unresolved external symbol __imp_getenv
1>LINK : error LNK2001: unresolved external symbol mainCRTStartup
1>C:\Users\User\Documents\Visual Studio Solutions\Order of the Stone\Order of the Stone\x64\Release\Order of the Stone.exe : fatal error LNK1120: 27 unresolved externals

運行時庫選項為“多線程DLL”(用於調試的“多線程調試DLL”)。 我正在使用預編譯的Windows GLFW二進制文件。 Windows SDK是Windows 10 SDK。

任何幫助表示贊賞。


編輯

我已經檢查了包含目錄的發行版,原來是錯誤的體系結構(32位而不是64位)。 但是現在,它給出了另一個未解決的外部因素列表:

1>glfw3.lib(monitor.c.obj) : error LNK2001: unresolved external symbol __security_check_cookie
1>glfw3.lib(wgl_context.c.obj) : error LNK2001: unresolved external symbol __security_check_cookie
1>glfw3.lib(egl_context.c.obj) : error LNK2001: unresolved external symbol __security_check_cookie
1>glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol __security_check_cookie
1>glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol __security_check_cookie
1>glfw3.lib(win32_init.c.obj) : error LNK2001: unresolved external symbol __security_check_cookie
1>glfw3.lib(win32_monitor.c.obj) : error LNK2001: unresolved external symbol __security_check_cookie
1>glad.obj : error LNK2001: unresolved external symbol __security_check_cookie
1>glfw3.lib(context.c.obj) : error LNK2001: unresolved external symbol __security_check_cookie
1>glfw3.lib(init.c.obj) : error LNK2001: unresolved external symbol __security_check_cookie
1>glfw3.lib(window.c.obj) : error LNK2001: unresolved external symbol __security_check_cookie
1>glad.obj : error LNK2001: unresolved external symbol __imp_realloc
1>glfw3.lib(win32_monitor.c.obj) : error LNK2001: unresolved external symbol __imp_realloc
1>glad.obj : error LNK2001: unresolved external symbol __imp_strncmp
1>glfw3.lib(context.c.obj) : error LNK2001: unresolved external symbol __imp_strncmp
1>glfw3.lib(egl_context.c.obj) : error LNK2001: unresolved external symbol __imp_strncmp
1>glfw3.lib(vulkan.c.obj) : error LNK2001: unresolved external symbol __imp_free
1>glfw3.lib(wgl_context.c.obj) : error LNK2001: unresolved external symbol __imp_free
1>glfw3.lib(egl_context.c.obj) : error LNK2001: unresolved external symbol __imp_free
1>glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol __imp_free
1>glfw3.lib(win32_init.c.obj) : error LNK2001: unresolved external symbol __imp_free
1>glfw3.lib(win32_monitor.c.obj) : error LNK2001: unresolved external symbol __imp_free
1>glfw3.lib(monitor.c.obj) : error LNK2001: unresolved external symbol __imp_free
1>glad.obj : error LNK2001: unresolved external symbol __imp_free
1>glfw3.lib(input.c.obj) : error LNK2001: unresolved external symbol __imp_free
1>glfw3.lib(window.c.obj) : error LNK2001: unresolved external symbol __imp_free
1>glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol __imp_free
1>glad.obj : error LNK2001: unresolved external symbol strstr
1>glad.obj : error LNK2001: unresolved external symbol __imp___stdio_common_vsscanf
1>glfw3.lib(context.c.obj) : error LNK2001: unresolved external symbol __imp___stdio_common_vsscanf
1>glad.obj : error LNK2001: unresolved external symbol __imp_malloc
1>Game.obj : error LNK2001: unresolved external symbol __CxxFrameHandler3
1>Game.obj : error LNK2001: unresolved external symbol __imp_exit
1>Game.obj : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned __int64)" (??2@YAPEAX_K@Z)
1>Game.obj : error LNK2001: unresolved external symbol "void __cdecl operator delete(void *,unsigned __int64)" (??3@YAXPEAX_K@Z)
1>Game.obj : error LNK2001: unresolved external symbol __std_terminate
1>Game.obj : error LNK2001: unresolved external symbol __imp__invalid_parameter_noinfo_noreturn
1>Game.obj : error LNK2001: unresolved external symbol __imp_getenv
1>LINK : error LNK2001: unresolved external symbol mainCRTStartup
1>glfw3.lib(context.c.obj) : error LNK2001: unresolved external symbol __imp_strstr
1>glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol __imp_strstr
1>glfw3.lib(wgl_context.c.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck
1>glfw3.lib(egl_context.c.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck
1>glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck
1>glfw3.lib(win32_init.c.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck
1>glfw3.lib(win32_monitor.c.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck
1>glfw3.lib(monitor.c.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck
1>glfw3.lib(context.c.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck
1>glfw3.lib(init.c.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck
1>glfw3.lib(window.c.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck
1>glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol __GSHandlerCheck
1>glfw3.lib(wgl_context.c.obj) : error LNK2001: unresolved external symbol __security_cookie
1>glfw3.lib(egl_context.c.obj) : error LNK2001: unresolved external symbol __security_cookie
1>glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol __security_cookie
1>glfw3.lib(win32_init.c.obj) : error LNK2001: unresolved external symbol __security_cookie
1>glfw3.lib(win32_monitor.c.obj) : error LNK2001: unresolved external symbol __security_cookie
1>glfw3.lib(monitor.c.obj) : error LNK2001: unresolved external symbol __security_cookie
1>glfw3.lib(context.c.obj) : error LNK2001: unresolved external symbol __security_cookie
1>glfw3.lib(init.c.obj) : error LNK2001: unresolved external symbol __security_cookie
1>glfw3.lib(window.c.obj) : error LNK2001: unresolved external symbol __security_cookie
1>glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol __security_cookie
1>glfw3.lib(wgl_context.c.obj) : error LNK2001: unresolved external symbol __imp_calloc
1>glfw3.lib(egl_context.c.obj) : error LNK2001: unresolved external symbol __imp_calloc
1>glfw3.lib(win32_init.c.obj) : error LNK2001: unresolved external symbol __imp_calloc
1>glfw3.lib(win32_monitor.c.obj) : error LNK2001: unresolved external symbol __imp_calloc
1>glfw3.lib(monitor.c.obj) : error LNK2001: unresolved external symbol __imp_calloc
1>glfw3.lib(vulkan.c.obj) : error LNK2001: unresolved external symbol __imp_calloc
1>glfw3.lib(input.c.obj) : error LNK2001: unresolved external symbol __imp_calloc
1>glfw3.lib(window.c.obj) : error LNK2001: unresolved external symbol __imp_calloc
1>glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol __imp_calloc
1>glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol __imp_calloc
1>glfw3.lib(monitor.c.obj) : error LNK2001: unresolved external symbol _fltused
1>glfw3.lib(input.c.obj) : error LNK2001: unresolved external symbol _fltused
1>glfw3.lib(window.c.obj) : error LNK2001: unresolved external symbol _fltused
1>glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol _fltused
1>glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol _fltused
1>glfw3.lib(init.c.obj) : error LNK2001: unresolved external symbol __imp___stdio_common_vsprintf
1>glfw3.lib(init.c.obj) : error LNK2001: unresolved external symbol __chkstk
1>glfw3.lib(win32_init.c.obj) : error LNK2001: unresolved external symbol memset
1>glfw3.lib(win32_monitor.c.obj) : error LNK2001: unresolved external symbol memset
1>glfw3.lib(init.c.obj) : error LNK2001: unresolved external symbol memset
1>glfw3.lib(window.c.obj) : error LNK2001: unresolved external symbol memset
1>glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol memset
1>glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol memset
1>glfw3.lib(win32_window.c.obj) : error LNK2001: unresolved external symbol __imp__strdup
1>glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol __imp__strdup
1>glfw3.lib(monitor.c.obj) : error LNK2001: unresolved external symbol __imp__strdup
1>glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol __imp_qsort
1>glfw3.lib(monitor.c.obj) : error LNK2001: unresolved external symbol __imp_qsort
1>glfw3.lib(win32_joystick.c.obj) : error LNK2001: unresolved external symbol sqrt
1>glfw3.lib(monitor.c.obj) : error LNK2001: unresolved external symbol pow
1>glfw3.lib(vulkan.c.obj) : error LNK2001: unresolved external symbol strcmp
1>C:\Users\User\Documents\Visual Studio Solutions\Order of the Stone\Order of the Stone\x64\Release\Order of the Stone.exe : fatal error LNK1120: 28 unresolved externals

請注意,32位發行版工作正常,它是64位發行版版本,具有這些奇怪的鏈接器錯誤。

由於某些原因,由於64位GLFW預制Windows二進制文件是Debug ,因此它無法鏈接,因為我的應用程序處於Release ,未提供必要的調試定義。 解決方案是自己在Release配置中從源代碼自己編譯GLFW,或者根本不使用64位GLFW(32位二進制文​​件是Release ,這很奇怪,因為我能夠在x86/Release構建我的應用程序)。 但是,我無法實際證明這一點,因為我不再使用GLFW,因為它不完全適合我的需求。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM