Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I link SDL with Visual Studio 2019

Tags:

sdl

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

like image 347
Ninetales53 Avatar asked Dec 23 '22 21:12

Ninetales53


1 Answers

I assume is the same as in VS 2017.

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 )

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 project debug folder ( the debug folder in the location 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[]).

like image 82
Bogdan Avatar answered Jan 31 '23 00:01

Bogdan