我尝试从此特定链接下载 SDL 库 https://www.youtube.com/watch?v=PTQkCRxr6lk&t=194s .但是我偶然发现了一个“ fatal error ”,我不知道该怎么做才能解决它。
这是我遇到的错误:
1>------ Build started: Project: SDL2, Configuration: Release x64 ------
2>------ Skipped Build: Project: uninstall, Configuration: Release x64 ------
2>Project not selected to build for this solution configuration
1> Creating library D:/Media/Downloads/SDL2-2.0.10/Build/Release/SDL2.lib and object D:/Media/Downloads/SDL2-2.0.10/Build/Release/SDL2.exp
1>SDL_string.obj : error LNK2019: unresolved external symbol memset referenced in function SDL_vsnprintf_REAL
1>D:\Media\Downloads\SDL2-2.0.10\Build\Release\SDL2.dll : fatal error LNK1120: 1 unresolved externals
1>Done building project "SDL2.vcxproj" -- FAILED.
3>------ Skipped Build: Project: INSTALL, Configuration: Release x64 ------
3>Project not selected to build for this solution configuration
========== Build: 0 succeeded, 1 failed, 4 up-to-date, 2 skipped ==========
最佳答案
@Neri-kun 我在 VS2019 上构建 SDL2 时遇到了完全相同的问题。 memset
似乎在vcruntime.dll
中,CMakeLists.txt
中没有。所以在CMakeLists.txt
中找到下面的部分,将vcruntime
添加到EXTRA_LIBS
中。问题解决:
# Libraries for Win32 native and MinGW
- list(APPEND EXTRA_LIBS user32 gdi32 winmm imm32 ole32 oleaut32 version uuid advapi32 shell32)
+ list(APPEND EXTRA_LIBS vcruntime user32 gdi32 winmm imm32 ole32 oleaut32 version uuid advapi32 shell32)
关于无法在 VS 2019 上以 Release模式为 SDL 库构建解决方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58288692/