我不知道如何将库与 Visual Studio 2019 链接(我使用的是 Windows 10),我该如何链接库?
最佳答案
我假设与 VS 2017 中的相同。
Project / "your project name" Properties... /
在 配置选择所有配置
然后
Project / "your project name" Properties... / Configuration Properties / VC++ Directories /
在 包含目录 添加 SDL 路径 包括 文件夹
在 图书馆目录 添加 SDL lib 文件夹的路径( lib/x86 或 lib/x64 )
然后
Project / "your project name" Properties... / Configuration Properties / Linker / Input /
在 附加依赖项 添加(按此顺序):
SDL2.lib
SDL2main.lib
然后复制所有 .dll 来自“您的 SDL 文件夹”/lib/(x86 或 x64)的文件
到您的 Visual Studio 项目 调试文件夹 (.sln 文件所在位置的调试文件夹)。
不要忘记使用
#include <SDL.h>
在你的代码中。也改
int main()
main.cpp 中的函数 int main(int argc, char* args[])
.
关于sdl - 如何将 SDL 与 Visual Studio 2019 链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57732058/