i am currently having problem compiling my project in dev c++ which uses SDL libraries, what i did was first download the file SDL2-devel-2.0.3-mingw.tar.gz
(MinGW
This error is common when using int main()
instead of :
int main(int argc, char **argv)
//or
int main(int argc, char *argv[])
Try replacing it with either of these.
In the background, SDL defines a macro #define main SDL_main
that renames your main(int argc, char *argv[])
function so that it does not conflict with its own main()
function (used for SDL initialization). If you use main()
instead, the macro does not modify it and SDL_main
is then not found.
If it does not work, follow these steps:
When you create your project, make sure you choose a Win32 GUI
or Win32 Console
application type.
After creating your project, I assume you added the following command line to your project parameters under linker : -lmingw32 - -lSD2main -lSDL2
Then put SDL2.dll
in your project directory where your executable will be.
Include SDL2.h
before main(int argc, char **argv)
begins in your source code.