cannot open file 'SDL2.lib'

17,527

Solution 1

Watch this video https://www.youtube.com/watch?v=or1dAmUO8k0.

In summary, you want to add the path include folder here: (configuration properties> C/C++ > General> Additional Include Directories),

and add the path of the lib folder here: (configuration properties> Linker > General> Additional Library Directories)

and finally, link .lib file in: linker > input > Additional Dependencies. enter image description here

Solution 2

It seems like you didn't add your library directory path in VC++ Directories/Library Directories.. You have to link your library directory path (Where you have save you libraries of SDL) in your program. After adding, it will definitely work

Solution 3

I would like to add for others experiencing this problem that its an easy mistake if you are using the Development Library to link to the lib folder. SDL needs you link to either the x86 or x64 folder in the lib folder.

Share:
17,527
Naor Hadar
Author by

Naor Hadar

Updated on September 01, 2022

Comments

  • Naor Hadar
    Naor Hadar almost 2 years

    I am trying to open sdl2 in my project on Visual C++ 2012 but i keep getting this error:

    error LNK1104: cannot open file 'SDL2.lib'

    I added the additional libraries and include folder but no luck.. I added the link to the libraries through the linker but i get the same error..

    what should i do?