sdl - 如何将 SDL 与 Visual Studio 2019 链接

标签 sdl

我不知道如何将库与 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/

相关文章:

haskell - Haskell 生命游戏在启动时崩溃

c++ - 无法使用 MinGW 链接到 SDL2 函数

c++ - SDL2 和 OpenGL 模板缓冲区不起作用

audio - 音频卷积输出比输入长,当将数据反馈到固定长度的流时,如何解决此问题?

c++ - 如何 "make"Linux 上的 SDL 项目?

python - 在 Mac 上安装 pygame 时出现 sdl.h 错误?

c# - MonoGame 与 SDL

linux - SDL 音频在 Linux 上随机失真

c++ - SDL_RenderCopy 没有做任何事情

c++ - 奇怪的 SDL blitting 行为