Using Code::blocks


looki

Still Fresh
Joined
Sep 6, 2009
Messages
7
Hello!

I got my Wiz a couple of days ago and I'm really happy with it. :)
Now I got interested in developing homebrew - I followed this tutorial. http://wiki.gp2x.org/wiki/Using_CodeBlocks
It seems to work fine - I can successfully compile the example.
The only problem is, it won't run on my Wiz.
My guess is that the example compiles statically, which is, according to many sources including IRC, not possible/recommended on the Wiz.
I removed the "-static" flag, and tried recompiling...
...and I get hundreds of errors.
sdltest.cpp:(.text+0xc): undefined reference to `SDL_FreeSurface'
It pretty much complains about all SDL functions used.
The header files are included - I don't get any error messages.
Proof: If I change their paths to something random, I do get error messages.

I tried writing the program's output into a file (via sh), which didn't work.
The log file was created, that's all.
I also put a printf() at the start of main() to make sure. Nothing.

Now my question simply is, how to fix this?
I am able to compile statically, although I'm not supposed to?!

Thanks, looki

EDIT: Oh, one note - I compiled another SDL example without the -static flag before, I didn't use Code::Blocks.
It worked on the Wiz.

EDIT2: I see - I just noticed the tutorial is on the GP2X wiki, not the Wiz one. So what do I need to do to make it work on the Wiz?
 
Read this post:
Using DevkitGP2X in the Wiz

If you use printf() you can't see the results on Wiz screen. If you redirect output to a file and the app fails on load, the file will be empty. You need execute from a terminal like "termula", or use a serial cable.
 
Last edited by a moderator:
Thanks. :)
I totally forgot to mention that I already read that post - I did modify the .so files and I set the flags as mentioned in the post.
I will try to use termula2x, thanks! Too bad I won't be able to within the next days, I can't wait.
 
Hey, thanks again.
Statically-linked programs seem to work indeed.
I added some printf()'s to the code, and it seems like the program exits on SDL_SetVideoMode():

Code:
...
SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER);
printf("SDL_Init\n");
screen = SDL_SetVideoMode(WINDOW_WIDTH, WINDOW_HEIGHT, 16, SDL_HWSURFACE | SDL_DOUBLEBUF);	// Set up screen for gp2x
printf("SDL_SetVideoMode\n");
...

The exact output is

Code:
SDL_GP2X: Looking for a mouse
SDL_GP2X: No mice found
SDL_SYS_JoystickInit
SDL_GP2X: SYS_JoystickName(0)
SDL_GP2X: SYS_JoystickName(1)
SDL_Init

Does anybody know why this is the case? Thanks for any answer.
By the way, the problem is not Code::Blocks-related anymore!
 
Back
Top