Ninetales53
Ninetales53

Reputation: 59

How do I link SDL with Visual Studio 2019

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

Upvotes: 5

Views: 12094

Answers (1)

Bogdan
Bogdan

Reputation: 521

It is the same as in VS 2017 and VS 2022.

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

At Configuration: select All Configurations

Then

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

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 depending the active solution platform you selected in "your project name" Properties / Configuration Manager... )

Then

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

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

Then copy all the .dll files from "your SDL folder" / lib / ( x86 or x64 ) to your Visual Studio solution debug folder ( the debug folder in the location where your .sln file is ).
In case you have solution and project in the same folder, then copy the files directly to your solution/project folder ( the folder where your .sln file is ).

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[]).

Upvotes: 12

Related Questions