Any recent SDL turotrials with CodeBlock?

I have recently tried LazyFoo's and this tutorial:
https://www.youtube.com/watch?v=wWGtuc5uqF4

So I am using CodeBlock for this.

I keep getting the same error:

1
2
ld.exe||cannot find -lSDLmain|
ld.exe||cannot find -lSDL|


They are using a 32 bit example, but I have a 64bit machine, so the file directory I am using is different. I have done exactly everything without mistakes, but I still get the above error. If I try to use the 32bit files, I get win api error, or whatever it is actually called. The "other liner options" is exactly identical. I added the SDL2 file in "compiler" tab and lib files in the "Linker" tab and I am still getting errors. So up to this point, I can only assume the tutorials are out dated because I don't see that I am doing anything wrong. Does anyone know of an up-to-date SDL tutorial?

This is the SDL code I am trying to run:

1
2
3
4
5
6
7
8
9
10
#include <SDL.h>

int main( int argc, char* args[] )
{ //Start SDL
    SDL_Init( SDL_INIT_EVERYTHING );
    //Quit SDL
    SDL_Quit();
    return 0;

}


Other linker options:


-lmingw32 -lSDLmain -lSDL

compiler:

C:\...\SDL\SDL2-2.0.3\x86_64-w64-mingw32\include\SDL2

Linker:

C:\...\SDL\SDL2-2.0.3\x86_64-w64-mingw32\lib

I have tried changing Other linker options: to:

-lmingw32 -lSDL2main -lSDL2

But then I get the new error:
1
2
3
C:\...\SDL\Code\test2\t\t.cpp|5|undefined reference to `SDL_Init'|
C:\...\SDL\Code\test2\t\t.cpp|7|undefined reference to `SDL_Quit'|
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\..\..\..\libmingw32.a(main.o):main.c:(.text.startup+0xa7)||undefined reference to `WinMain@16'| 
Last edited on
UPDATE:

Okay, it turns out that a bug affects 32-bit version of the SDL 2.0.3 files. I replaced the platform file that is bugged. Everything works for the 32-bit compilation, but the 64-bit compilation doesn't work. This might be because my CodeBlock is currently a 32-bit compiler, but I am not very familiar with CodeBlock. Does CodeBlock need ot be configured to 64-bit before it can compile the 64-bit SDL 2.0.3 codes?

http://stackoverflow.com/questions/22446008/winapifamily-h-no-such-file-or-directory-when-compiling-sdl-in-codeblocks
Last edited on
Does CodeBlock need ot be configured to 64-bit before it can compile the 64-bit SDL 2.0.3 codes?
Yes.

There's pretty much no reason for you to do it, though.
Last edited on
Topic archived. No new replies allowed.