I'm using Win7x64 and have installed codeblocks 13.12. It compiles a hello world app fine so now I'm trying to setup a similar sdl project but having issues with 2 different approaches.
I've uncompressed SDL2-devel-2.0.3-mingw.tar.gz to a new SDL folder inside the CodeBlocks folder.
#1
If I use the File->New Project From Template -> SDL Project and point to the root uncompressed SDL folder it complains 'can't locate the following SDL's library file: SDLmain in it'. Sure enough I don't see that file either.
(Similar to :
http://forums.codeblocks.org/index.php?topic=16546.0 )
#2
If I manually create a c++ test project and set the linker libraries to the SDL's libSDl2.a, libSDL2main.a, and SDL2.lib with the linker options ordered: -lmingw32 -lSDL2main -lSDL2 -mwindows . In the search directories I point it to the SDL's include folder. Finally I copied SDL2.dll to my test project's folder.
#include <SDL.h>
int main()
{
SDL_Init(SDL_INIT_EVERYTHING);
return 0;
}
When I compile it complains of a missing winapifamily.h. However, I found this stackoverflow post and copied the SDL_platform.h it references and the error went away:
http://stackoverflow.com/questions/22446008/winapifamily-h-no-such-file-or-directory-when-compiling-sdl-in-codeblocksBut unfortunately, now I get 2 different errors:
undefined reference to 'SDL_Init' and undefined reference to 'WinMain@16'
(Similar problems here :
http://forums.codeblocks.org/index.php?topic=10701.0 ,
https://wiki.libsdl.org/FAQWindows)
I've tried everything I've read, but no luck.
I can't imagine that setting this is up can be that complicated, so I must be doing something dumb, but what?! The SDL zip has a few include and lib folders (one in the root, one in x86_64_mingw32, and one in i686_w64_mingw32), I've tried the root ones and the x86 ones but could it be the i686? Or is it related to the SDL_platform.h that I changed?
Does anyone have a working sdl hello world project that they wouldn't mind sharing? Hopefully I can then reconstruct the folder paths (in case that's the issue). Otherwise is there a way I can get the #1 approach above to work?
Thanks!
[update] I just bought the $5 ebook on code::blocks (
https://www.packtpub.com/application-development/c-application-development-codeblocks ) but fyi, it doesn't use any sdl