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;
}
George Kagan
6,1448 gold badges50 silver badges50 bronze badges
-
did you lind the SDL library? check how to ask and post more details about the os/compiler/lnker/librariesbibi– bibi2016年12月04日 19:10:54 +00:00Commented Dec 4, 2016 at 19:10
1 Answer 1
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
- Goto Project properties
- In Linker -> Input and and specify the SDL dlls
- In Linker -> General -> Additional Library Directories specify the path to the SDL dlls
Sign up to request clarification or add additional context in comments.
2 Comments
Vitor
I fixed it, i used the x32 instead of the x64 one that i was using previously and this fixed it, even though i'm on a 64 bit machine, thanks anyways !
jumper0x08
Oh in that case the SDL libraries you are using must be 32 bit. You cannot link a 32 bit dll with 64-bit application. The architecture should match.
lang-cpp