4

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
asked Dec 1, 2016 at 21:30
1
  • did you lind the SDL library? check how to ask and post more details about the os/compiler/lnker/libraries Commented Dec 4, 2016 at 19:10

1 Answer 1

3

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
answered Dec 1, 2016 at 21:41
Sign up to request clarification or add additional context in comments.

2 Comments

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 !
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.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.