Noob Question Regarding Codeblocks Ide


mentalmummy

Still Fresh
Joined
Jan 26, 2007
Messages
18
I`m just starting, at 33, to learn C++ programming having been inspired by the GP2X.

I`ve read tutorials on how to set up the CodeBlocks IDE to compile GPX2 stuff and done that fine but am stuck on one stupid little point.

I downloaded an SDL test program to compile and the guide says to create an "empty project" from Codeblocks create new project menu. However when I go there I find no option for an empty project, only options for the standard things like GUI and CONSOLE etcetera.

I have codeblocks ide version 1.0 rc 2 which as far as I know is the latest option so could someone indulge a C++ newb and tell me how to start an empty project as when I click NEW PROJECT it won`t allow me to create an empty one only to use one of the templates.

Thanks for any assistance :)

Dave
 
Instead of clicking on 'File', click on 'Project' and go to:

Project > New empty project

:)

- Alex
 
I was going to the file>project menu - thanks for pointing out the rather silly mistake I`ve been making!

I`ve been following the guide at http://wiki.gp2x.org/wiki/Using_CodeBlocks


I must be doing something very wrong as when I hit build>build as in the guide I get the following:

Project : NewTest
Compiler : GNU GCC Compiler (called directly)
Directory : C:\NewTest\
--------------------------------------------------------------------------------
Switching to target: default
Linking executable: C:\NewTest\NewTest.gpe
arm-linux-g++.exe: if: No such file or directory
arm-linux-g++.exe: that: No such file or directory
arm-linux-g++.exe: doesn't: No such file or directory
arm-linux-g++.exe: work,: No such file or directory
arm-linux-g++.exe: copy: No such file or directory
arm-linux-g++.exe: the: No such file or directory
arm-linux-g++.exe: LIBS =: No such file or directory
arm-linux-g++.exe: arguments: No such file or directory
arm-linux-g++.exe: from: No such file or directory
arm-linux-g++.exe: the: No such file or directory
arm-linux-g++.exe: example: No such file or directory
arm-linux-g++.exe: makefile:: Invalid argument
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings


So I am going to try and figure it out again tomorrow. Thanks again :)
 
Code:
Compiler : GNU GCC Compiler (called directly)
It looks like you have changed the default GCC Compiler settings rather then copy it, then modify the copy. Read Step 2, or more specifically, step 2.4 of the guide.

Edit: Cancel that, it looks like you copied and pasted too much. I think you copied this
Code:
-static -lSDL_gfx -lSDL_ttf -lfreetype -lSDL_image -ljpeg -lpng12 -lz -lSDL_mixer -lvorbisidec -lmikmod -lmad -lSDL -lgcc -lm -lc -lexpat -lpthread

if that doesn't work, copy the "LIBS =" arguments from the example makefile:
-L"C:/devkitGP2X/lib" -lSDL -lSDL_gfx --start-group -lSDL_ttf -lfreetype -lSDL --end-group -lSDL_image -ljpeg -lpng12 -lz --start-group -lSDL_mixer -lvorbisidec -lmikmod -lsmpeg -lmad -lSDL --end-group -lgcc -lm -lc -lexpat -lpthread -ldl

When it should be either
Code:
-static -lSDL_gfx -lSDL_ttf -lfreetype -lSDL_image -ljpeg -lpng12 -lz -lSDL_mixer -lvorbisidec -lmikmod -lmad -lSDL -lgcc -lm -lc -lexpat -lpthread
or
Code:
-L"C:/devkitGP2X/lib" -lSDL -lSDL_gfx --start-group -lSDL_ttf -lfreetype -lSDL --end-group -lSDL_image -ljpeg -lpng12 -lz --start-group -lSDL_mixer -lvorbisidec -lmikmod -lsmpeg -lmad -lSDL --end-group -lgcc -lm -lc -lexpat -lpthread -ldl

I go and correct that now on the Wiki.
 
I tried copying the text as you posted it and it seems you are definitely right as having copied the different text in I get a completely different set of errors now which are:

Project : NewTest
Compiler : GNU GCC Compiler (called directly)
Directory : C:\NewTest\
--------------------------------------------------------------------------------
Switching to target: default
Compiling: sdltest.cpp
sdltest.cpp: In function 'void TestNewJoystick()':
sdltest.cpp:536: error: 'BACK_LIGHT_OFF' was not declared in this scope
sdltest.cpp:536: error: 'SDL_SYS_JoystickGp2xSys' was not declared in this scope
sdltest.cpp:536: error: 'BACK_LIGHT_ON' was not declared in this scope
sdltest.cpp:537: error: 'BATT_LED_ON' was not declared in this scope
sdltest.cpp:537: error: 'SDL_SYS_JoystickGp2xSys' was not declared in this scope
sdltest.cpp:537: error: 'BATT_LED_OFF' was not declared in this scope
Process terminated with status 1 (0 minutes, 0 seconds)
6 errors, 0 warnings


And the line highlighted by Codeblocks reads:

if(option==2){SDL_SYS_JoystickGp2xSys(joy,BATT_LED_ON);SDL_Delay(500);SDL_SYS_JoystickGp2xSys(joy,BATT_LED_OFF);SDL_Delay(500);SDL_SYS_JoystickGp2xSys(joy,BATT_LED_ON);SDL_Delay(500);SDL_SYS_JoystickGp2xSys(joy,BATT_LED_OFF);SDL_Delay(500);SDL_SYS_JoystickGp2xSys(joy,BATT_LED_ON);SDL_Delay(500);SDL_SYS_JoystickGp2xSys(joy,BATT_LED_OFF);SDL_Delay(500);}

I am a complete newb so I`m going to have to figure it out somehow but it seems to me that maybe I have an include file missing somehow?

Doesn`t the error message about not being declared mean the variables have not been defined and therefore that would mean I am missing something?

I am going to redownload the sdl test in case I got a corrupted download!

Thanks for all the patience and help, definitely appreciate it and my GP2X arrived today so I`m looking forward to when I advance to be able to actually write something :D
 
Without looking at your setup I can only speculate that you did not change the include paths for the compiler options.

Step 2.6 in the Wiki guide. Either that or you need to update your SDL libraries as this may be an 'updated' version of the test.

You can grab the updated libraries from Step1v2.2 in the Wiki guide.

http://www.gp2x.de/cgi-bin/cfiles.cgi?0,0,0,0,19,1875
 
Without looking at your setup I can only speculate that you did not change the include paths for the compiler options.

Step 2.6 in the Wiki guide. Either that or you need to update your SDL libraries as this may be an 'updated' version of the test.

You can grab the updated libraries from Step1v2.2 in the Wiki guide.

http://www.gp2x.de/cgi-bin/cfiles.cgi?0,0,0,0,19,1875

That`s what I did grabbed the libraries and test from the wiki links as I did with the test fle as well. I have checked again the compiler paths as in step 2.6 but they and the libraries appear to be correct so as it`s 1.30 am here I am going to bed and try figure it out tomorrow (well, later today :D ).

Thanks for all the help everyones giving, I am sure it will help point me to the root of the problem which must be something simple that I just can`t notice yet!

Dave
 
Last edited by a moderator:
Back
Top