I am trying to compile simple code :
#include <iostream>
#include <SDL2/SDL.h>
int main(int argc, char *argv[])
{
}
but it gives me a lot of bloody errors:
||=== Build: Debug in aa (compiler: GNU GCC Compiler) ===|
E:\SDL2\SDL2-2.0.12\i686-w64-mingw32\lib\libSDL2main.a(SDL_windows_main.o)||In function `main_getcmdline':|
\Users\valve\release\SDL\SDL2-2.0.12-source\foo-x86\..\src\main\windows\SDL_windows_main.c|55|undefined reference to `SDL_calloc'|
\Users\valve\release\SDL\SDL2-2.0.12-source\foo-x86\..\src\main\windows\SDL_windows_main.c|60|undefined reference to `SDL_wcslen'|
\Users\valve\release\SDL\SDL2-2.0.12-source\foo-x86\..\src\main\windows\SDL_windows_main.c|60|undefined reference to `SDL_iconv_string'|
E:\SDL2\SDL2-2.0.12\i686-w64-mingw32\lib\libSDL2main.a(SDL_windows_main.o)||In function `OutOfMemory':|
\Users\valve\release\SDL\SDL2-2.0.12-source\foo-x86\..\src\main\windows\SDL_windows_main.c|28|undefined reference to `SDL_ShowSimpleMessageBox'|
E:\SDL2\SDL2-2.0.12\i686-w64-mingw32\lib\libSDL2main.a(SDL_windows_main.o)||In function `main_getcmdline':|
\Users\valve\release\SDL\SDL2-2.0.12-source\foo-x86\..\src\main\windows\SDL_windows_main.c|68|undefined reference to `SDL_SetMainReady'|
\Users\valve\release\SDL\SDL2-2.0.12-source\foo-x86\..\src\main\windows\SDL_windows_main.c|75|undefined reference to `SDL_free'|
\Users\valve\release\SDL\SDL2-2.0.12-source\foo-x86\..\src\main\windows\SDL_windows_main.c|77|undefined reference to `SDL_free'|
||error: ld returned 1 exit status|
||=== Build failed: 8 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
I don't understand why it would give me undefines to random functions when the library itself seems to be working, but alas.
The things i've done as of now are
- add -lmingw32 -lSDL2 -lSDL2main to linker settings-> other linker options
- added the include folder for the 32 bit version to search directories-> compiler
- added the lib folder for the 32 bit version to search directories-> linker
- added the SDL2.dll to the bin folder of my compiler (i have mingw separately from codeblocks)