kyu
kyu

Reputation: 11

my IMG_Load method doesn't work with LNK2019 error

I'm trying to make a game on visual studio 2013 with SDL.
when I'm typed :

SDL_Surface* pTempSurface = IMG_Load("assets/na.png"); <br><br>

error occurred like :

Error 2 error LNK2019: unresolved external symbol _IMG_Load referenced in function

I already check project properties, c/c++,linker Additional Include/Library Directories and I also checked Linker|Input|Addtional Dependencies
, header files, place dll files to excutable folder too.

I don't know why this problem happened.
Can anyone tell me what should I do?

Upvotes: 0

Views: 2851

Answers (1)

gibertoni
gibertoni

Reputation: 1378

This is a linking problem, which means that when Visual Studio is trying to link you code to the already compiled SDL_image one, it is not finding the binary for this method.

The only way to solve this is by checking the following:

  • The path to the .lib files has to be correctly inserted at Project -> Properties-> VC++Directories -> Library Directories
  • The flag that links the library is correctly inserted at Project -> Properties -> Linker -> Input -> Additional Dependencies (SDL_image.lib)

If the problem were a missing DLL, it would crash on runtime. It it were a missing header, it would give a compiler error saying that the IMG_Load was not defined.

Upvotes: 1

Related Questions