Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LNK2019 unresolved external symbol _SDL_Init referenced in function _SDL_main

Every time I try to run the code below I get the error that is in the title, how do I fix this?

#include <SDL\SDL.h>
int main(int argc, char** argv) {

    SDL_Init(SDL_INIT_EVERYTHING);

    return 0;
}
like image 641
Vitor Avatar asked Sep 15 '25 05:09

Vitor


1 Answers

The error means that the linker is unable to find the function SDL_Init. This is usually caused by improper paths to the libraries that contain function definition.

In our case :

You can either put all required SDL dlls into your Output directory(by default it will be the bin folder)

Or

  1. Goto Project properties
  2. In Linker -> Input and and specify the SDL dlls
  3. In Linker -> General -> Additional Library Directories specify the path to the SDL dlls
like image 85
jumper0x08 Avatar answered Sep 16 '25 23:09

jumper0x08