I've been trying to compile a SDL2 code in C++, a console application. I use Code::Blocks with GNU GCC Complier. This is the code:
#include <iostream>
#include <SDL2/SDL.h>
int main( int argc, char *argv[] )
{
if ( SDL_Init( SDL_INIT_EVERYTHING ) < 0)
{
std::cout << "SDL could not initialise! SDL Error: " << SDL_GetError( )<< std::endl;
}
return EXIT_SUCCESS;
}
It gives me these errors:
undefined reference to `SDL_Init'
undefined reference to `SDL_GetError'
undefined reference to `WinMain@16'
I have "-lmingw32 -lSDL2main -lSDL2" in the other linker options, and and in Search directories I put:
- ......\SDL2-devel-2.0.5-mingw\SDL2-2.0.5\x86_64-w64-mingw32\include in Compiler
- ......\SDL2-devel-2.0.5-mingw\SDL2-2.0.5\x86_64-w64-mingw32\lib in Linker
I moved all include, lib and bin files to the MinGW's folders.
Any idea of what's what I'm doing badly?
Thank you!
#undef mainon the line beforeint main(...)