如何将 SDL 与 Visual Studio 2019 链接 [英] How do I link SDL with Visual Studio 2019

查看:128
本文介绍了如何将 SDL 与 Visual Studio 2019 链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道如何将库与 Visual Studio 2019 链接(我使用的是 Windows 10),我如何链接库?

I don't know how to link libraries with Visual Studio 2019 (I am using Windows 10), how do I link libraries?

推荐答案

我假设与 VS 2017 中的相同.

I assume is the same as in VS 2017.

项目/您的项目名称"属性.../

Project / "your project name" Properties... /

配置选择所有配置

然后

项目/您的项目名称"属性.../配置属性/VC++目录/

Project / "your project name" Properties... / Configuration Properties / VC++ Directories /

包含目录添加到您的 SDL include 文件夹的路径
Library Directory 中添加 SDL lib 文件夹的路径(lib/x86lib/x64)

At Include Directories add path to your SDL include folder
At Library Directories add path to your SDL lib folder ( lib/x86 or lib/x64 )

然后

项目/您的项目名称"属性.../配置属性/链接器/输入/

Project / "your project name" Properties... / Configuration Properties / Linker / Input /

附加依赖项处添加(按此顺序):
SDL2.lib
SDL2main.lib

At Additional Dependencies add ( in this order ):
SDL2.lib
SDL2main.lib

然后从您的 SDL 文件夹"/lib/(x86 或 x64)复制所有 .dll 文件到您的 Visual Studio 项目调试文件夹(.sln 文件所在位置的调试文件夹).

Then copy all the .dll files from "your SDL folder" / lib / ( x86 or x64 ) to your Visual Studio project debug folder ( the debug folder in the location where your .sln file is ).

不要忘记在代码中使用 #include .
还要使用 int main(int argc, char* args[]) 更改 main.cpp 中的 int main() 函数.

Don't forget to use #include <SDL.h> in your code.
Also change int main() function in main.cpp with int main(int argc, char* args[]).

这篇关于如何将 SDL 与 Visual Studio 2019 链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆