Codeblocks Environment Setup


yaustar

UK GP32 & GP2X Owner
Joined
Oct 18, 2003
Messages
2,714
Location
UK
Website
Visit site
Try to setup a development environment using Codeblocks as an IDE (as it is constantly being developed on) but hit an linking errors trying to compile Guyfawkes SDL example in his user guide.

Using all the Libs linked from the guide and the latest release from http://www.codeblocks.org/

snippet of errors:
Code:
Project   : test
Compiler  : DevKitGP2X (called directly)
Directory : D:\GP2X\Test\
--------------------------------------------------------------------------------
Switching to target: default
Linking executable: D:\GP2X\Test\test.exe
C:\DevKitGP2X\lib\libSDL.a(SDL_systhread.o): In function `SDL_SYS_CreateThread':
SDL_systhread.c:(.text+0xac): undefined reference to `pthread_create'
C:\DevKitGP2X\lib\libSDL.a(SDL_systhread.o): In function `SDL_SYS_SetupThread':
SDL_systhread.c:(.text+0x184): undefined reference to `pthread_sigmask'
C:\DevKitGP2X\lib\libSDL.a(SDL_systhread.o): In function `SDL_SYS_WaitThread':
SDL_systhread.c:(.text+0x1e8): undefined reference to `pthread_join'
C:\DevKitGP2X\lib\libSDL.a(SDL_systhread.o): In function `SDL_SYS_KillThread':
SDL_systhread.c:(.text+0x210): undefined reference to `pthread_cancel'
C:\DevKitGP2X\lib\libSDL.a(SDL_sysmutex.o): In function `SDL_CreateMutex':
SDL_sysmutex.c:(.text+0x40): undefined reference to `pthread_mutexattr_init'
SDL_sysmutex.c:(.text+0x50): undefined reference to `pthread_mutexattr_setkind_np'
C:\DevKitGP2X\lib\libSDL.a(SDL_syssem.o): In function `SDL_CreateSemaphore':
SDL_syssem.c:(.text+0x4c): undefined reference to `sem_init'
C:\DevKitGP2X\lib\libSDL.a(SDL_syssem.o): In function `SDL_DestroySemaphore':
SDL_syssem.c:(.text+0xe0): undefined reference to `sem_destroy'
C:\DevKitGP2X\lib\libSDL.a(SDL_syssem.o): In function `SDL_SemTryWait':
SDL_syssem.c:(.text+0x148): undefined reference to `sem_trywait'
C:\DevKitGP2X\lib\libSDL.a(SDL_syssem.o): In function `SDL_SemWait':
SDL_syssem.c:(.text+0x1d0): undefined reference to `sem_wait'
C:\DevKitGP2X\lib\libSDL.a(SDL_syssem.o): In function `SDL_SemValue':
SDL_syssem.c:(.text+0x34c): undefined reference to `sem_getvalue'
C:\DevKitGP2X\lib\libSDL.a(SDL_syssem.o): In function `SDL_SemPost':
SDL_syssem.c:(.text+0x3c4): undefined reference to `sem_post'
C:\DevKitGP2X\lib\libSDL_image.a(IMG_bmp.o): In function `LoadBMP_RW':
IMG_bmp.c:(.text+0x65c): undefined reference to `SDL_ReadLE32'
IMG_bmp.c:(.text+0x66c): undefined reference to `SDL_ReadLE16'
IMG_bmp.c:(.text+0x684): undefined reference to `SDL_ReadLE16'
IMG_bmp.c:(.text+0x69c): undefined reference to `SDL_ReadLE32'
IMG_bmp.c:(.text+0x6ac): undefined reference to `SDL_ReadLE32'
IMG_bmp.c:(.text+0x6c8): undefined reference to `SDL_ReadLE16'
IMG_bmp.c:(.text+0x6d8): undefined reference to `SDL_ReadLE16'
IMG_bmp.c:(.text+0x6e8): undefined reference to `SDL_ReadLE16'
IMG_bmp.c:(.text+0x700): undefined reference to `SDL_ReadLE16'
IMG_bmp.c:(.text+0x74c): undefined reference to `SDL_ReadLE32'
IMG_bmp.c:(.text+0x75c): undefined reference to `SDL_ReadLE32'
IMG_bmp.c:(.text+0x76c): undefined reference to `SDL_ReadLE16'
IMG_bmp.c:(.text+0x784): undefined reference to `SDL_ReadLE16'
IMG_bmp.c:(.text+0x79c): undefined reference to `SDL_ReadLE32'
IMG_bmp.c:(.text+0x7ac): undefined reference to `SDL_ReadLE32'
IMG_bmp.c:(.text+0x7bc): undefined reference to `SDL_ReadLE32'
IMG_bmp.c:(.text+0x7cc): undefined reference to `SDL_ReadLE32'
IMG_bmp.c:(.text+0x7dc): undefined reference to `SDL_ReadLE32'
.................
.................
C:\DevKitGP2X\lib\libSDL_mixer.a(wavestream.o): In function `LoadAIFFStream':
wavestream.c:(.text+0xd90): undefined reference to `SDL_ReadBE32'
wavestream.c:(.text+0xda0): undefined reference to `SDL_ReadLE32'
wavestream.c:(.text+0xdf4): undefined reference to `SDL_ReadLE32'
wavestream.c:(.text+0xe04): undefined reference to `SDL_ReadBE32'
wavestream.c:(.text+0xe84): undefined reference to `SDL_ReadBE32'
wavestream.c:(.text+0xe94): undefined reference to `SDL_ReadBE32'
wavestream.c:(.text+0xee8): undefined reference to `SDL_ReadBE16'
wavestream.c:(.text+0xf00): undefined reference to `SDL_ReadBE32'
wavestream.c:(.text+0xf10): undefined reference to `SDL_ReadBE16'

Cheers.
 
Now currently getting these errors

Code:
Project   : test
Compiler  : DevKitGP2X (called directly)
Directory : D:\GP2X\Test\
--------------------------------------------------------------------------------
Switching to target: default
Linking executable: D:\GP2X\Test\test.gpe
.objs\sdltest.o: In function `Shutdown()':
sdltest.cpp:(.text+0xc): undefined reference to `SDL_FreeSurface'
sdltest.cpp:(.text+0x18): undefined reference to `SDL_FreeSurface'
sdltest.cpp:(.text+0x24): undefined reference to `Mix_FreeChunk'
sdltest.cpp:(.text+0x30): undefined reference to `Mix_FreeMusic'
sdltest.cpp:(.text+0x34): undefined reference to `Mix_CloseAudio'
sdltest.cpp:(.text+0x40): undefined reference to `TTF_CloseFont'
sdltest.cpp:(.text+0x44): undefined reference to `TTF_Quit'
.objs\sdltest.o: In function `LoadFont(unsigned char)':
sdltest.cpp:(.text+0x8c): undefined reference to `TTF_OpenFont'
.objs\sdltest.o: In function `drawText(SDL_Surface*, char*, int, int, int, int, int)':
sdltest.cpp:(.text+0xe8): undefined reference to `TTF_RenderText_Blended'
sdltest.cpp:(.text+0x110): undefined reference to `SDL_UpperBlit'
sdltest.cpp:(.text+0x118): undefined reference to `SDL_FreeSurface'
.objs\sdltest.o: In function `drawTextInt(SDL_Surface*, int, int, int, int, int, int)':
sdltest.cpp:(.text+0x190): undefined reference to `TTF_RenderText_Blended'
sdltest.cpp:(.text+0x1bc): undefined reference to `SDL_UpperBlit'
sdltest.cpp:(.text+0x1c4): undefined reference to `SDL_FreeSurface'
.objs\sdltest.o: In function `drawSprite(SDL_Surface*, SDL_Surface*, int, int, int, int, int, int)':
sdltest.cpp:(.text+0x230): undefined reference to `SDL_UpperBlit'
.objs\sdltest.o: In function `WaitForKey()':
sdltest.cpp:(.text+0x284): undefined reference to `SDL_PollEvent'
.objs\sdltest.o: In function `TestSDLTTF()':
sdltest.cpp:(.text+0x2c0): undefined reference to `SDL_MapRGB'
sdltest.cpp:(.text+0x2d4): undefined reference to `SDL_FillRect'
sdltest.cpp:(.text+0x37c): undefined reference to `SDL_Flip'
.objs\sdltest.o: In function `TestSDLImage()':
sdltest.cpp:(.text+0x3b8): undefined reference to `SDL_MapRGB'
sdltest.cpp:(.text+0x3c8): undefined reference to `SDL_FillRect'
sdltest.cpp:(.text+0x3d0): undefined reference to `IMG_Load'
sdltest.cpp:(.text+0x440): undefined reference to `SDL_MapRGB'
sdltest.cpp:(.text+0x450): undefined reference to `SDL_SetColorKey'
sdltest.cpp:(.text+0x480): undefined reference to `IMG_Load'
sdltest.cpp:(.text+0x4e0): undefined reference to `SDL_MapRGB'
sdltest.cpp:(.text+0x4f0): undefined reference to `SDL_SetColorKey'
sdltest.cpp:(.text+0x51c): undefined reference to `IMG_Load'
sdltest.cpp:(.text+0x590): undefined reference to `SDL_Flip'
.objs\sdltest.o: In function `TestInput()':
sdltest.cpp:(.text+0x5f4): undefined reference to `SDL_MapRGB'
sdltest.cpp:(.text+0x604): undefined reference to `SDL_FillRect'
sdltest.cpp:(.text+0x674): undefined reference to `SDL_Flip'
sdltest.cpp:(.text+0x974): undefined reference to `SDL_PollEvent'
.objs\sdltest.o: In function `TestSDLMixerWAV()':
sdltest.cpp:(.text+0xa04): undefined reference to `SDL_MapRGB'
sdltest.cpp:(.text+0xa14): undefined reference to `SDL_FillRect'
sdltest.cpp:(.text+0xa40): undefined reference to `SDL_Flip'
sdltest.cpp:(.text+0xa4c): undefined reference to `SDL_RWFromFile'
sdltest.cpp:(.text+0xa54): undefined reference to `Mix_LoadWAV_RW'
sdltest.cpp:(.text+0xa74): undefined reference to `Mix_PlayChannelTimed'
sdltest.cpp:(.text+0xa80): undefined reference to `Mix_Playing'
sdltest.cpp:(.text+0xaa4): undefined reference to `SDL_MapRGB'
sdltest.cpp:(.text+0xab4): undefined reference to `SDL_FillRect'
sdltest.cpp:(.text+0xafc): undefined reference to `SDL_Flip'
.objs\sdltest.o: In function `TestSDLMixerOGG()':
sdltest.cpp:(.text+0xb34): undefined reference to `Mix_LoadMUS'
sdltest.cpp:(.text+0xb44): undefined reference to `Mix_PlayMusic'
sdltest.cpp:(.text+0xb68): undefined reference to `SDL_MapRGB'
sdltest.cpp:(.text+0xb78): undefined reference to `SDL_FillRect'
sdltest.cpp:(.text+0xcb8): undefined reference to `SDL_Flip'
sdltest.cpp:(.text+0xd30): undefined reference to `Mix_VolumeMusic'
sdltest.cpp:(.text+0xd40): undefined reference to `Mix_PauseMusic'
sdltest.cpp:(.text+0xd4c): undefined reference to `Mix_ResumeMusic'
sdltest.cpp:(.text+0xd58): undefined reference to `Mix_RewindMusic'
sdltest.cpp:(.text+0xdc4): undefined reference to `Mix_VolumeMusic'
sdltest.cpp:(.text+0xdd4): undefined reference to `Mix_PauseMusic'
sdltest.cpp:(.text+0xde0): undefined reference to `Mix_ResumeMusic'
sdltest.cpp:(.text+0xdec): undefined reference to `Mix_RewindMusic'
sdltest.cpp:(.text+0xdf4): undefined reference to `SDL_PollEvent'
sdltest.cpp:(.text+0xe08): undefined reference to `Mix_HaltMusic'
.objs\sdltest.o: In function `TestSDLMixerMOD()':
sdltest.cpp:(.text+0xe6c): undefined reference to `SDL_MapRGB'
sdltest.cpp:(.text+0xe7c): undefined reference to `SDL_FillRect'
sdltest.cpp:(.text+0xec8): undefined reference to `Mix_LoadMUS'
sdltest.cpp:(.text+0xed8): undefined reference to `Mix_PlayMusic'
sdltest.cpp:(.text+0xee0): undefined reference to `SDL_Flip'
sdltest.cpp:(.text+0xee8): undefined reference to `Mix_HaltMusic'
.objs\sdltest.o: In function `TestSDLTimer()':
sdltest.cpp:(.text+0xf14): undefined reference to `SDL_GetTicks'
sdltest.cpp:(.text+0xf34): undefined reference to `SDL_MapRGB'
sdltest.cpp:(.text+0xf44): undefined reference to `SDL_FillRect'
sdltest.cpp:(.text+0xf70): undefined reference to `SDL_Flip'
sdltest.cpp:(.text+0xf74): undefined reference to `SDL_GetTicks'
sdltest.cpp:(.text+0xfa4): undefined reference to `SDL_MapRGB'
sdltest.cpp:(.text+0xfb4): undefined reference to `SDL_FillRect'
sdltest.cpp:(.text+0xfe0): undefined reference to `SDL_Flip'
.objs\sdltest.o: In function `main':
sdltest.cpp:(.text+0x1008): undefined reference to `SDL_Init'
sdltest.cpp:(.text+0x1010): undefined reference to `SDL_ShowCursor'
sdltest.cpp:(.text+0x1024): undefined reference to `SDL_SetVideoMode'
sdltest.cpp:(.text+0x1040): undefined reference to `SDL_WM_SetCaption'
sdltest.cpp:(.text+0x1048): undefined reference to `SDL_JoystickOpen'
sdltest.cpp:(.text+0x104c): undefined reference to `TTF_Init'
sdltest.cpp:(.text+0x1060): undefined reference to `Mix_OpenAudio'
sdltest.cpp:(.text+0x1084): undefined reference to `SDL_MapRGB'
sdltest.cpp:(.text+0x1094): undefined reference to `SDL_FillRect'
sdltest.cpp:(.text+0x1298): undefined reference to `SDL_Flip'
sdltest.cpp:(.text+0x1444): undefined reference to `SDL_PollEvent'
Process terminated with status 1 (0 minutes, 1 seconds)
0 errors, 0 warnings

I must be linking the libraries incorrectly but I can't see any obvious mistakes. The default directory is set correctly and I have tried linking via the command line but no joy.
 
if you are building Guyfawkes sdltest these are linker flags I used
-static -lSDL_mixer -lSDL_ttf -lSDL_image -lmikmod -lvorbisidec -lfreetype -ljpeg -lpng12 -lz -lm -lSDL -lpthread
 
Decided to go from scratch. Added -lpthread to "other linker options" since I can't find the lib and get this error:
Code:
Project   : test
Compiler  : DevKitGP2X (called directly)
Directory : D:\GP2X\Test\
--------------------------------------------------------------------------------
Switching to target: default
Compiling: sdltest.cpp
Linking executable: D:\GP2X\Test\test.gpe
c:\devkitgp2x\bin\..\lib\gcc\arm-linux\4.0.2\..\..\..\..\arm-linux\bin\ld.exe: cannot find /usr/lib/ inside c:\devkitgp2x\arm-linux\bin\../../sysroot
Process terminated with status 1 (0 minutes, 1 seconds)
0 errors, 0 warnings

Had a snoop around, why is libpthread all the way in \devkitGP2X\sysroot\usr\lib?
 
do you have the -static in the linker command line. I get the same error without it but it builds with it.
 
-static -lpthread gets rid of that error. Get lots of 'undefined reference' errors.

-static -lSDL -lSDLmain -lpthread
iget
Code:
Project   : test
Compiler  : DevKitGP2X (called directly)
Directory : D:\GP2X\Test\
--------------------------------------------------------------------------------
Switching to target: default
Linking executable: D:\GP2X\Test\test.gpe
.objs\sdltest.o: In function `Shutdown()':
sdltest.cpp:(.text+0x24): undefined reference to `Mix_FreeChunk'
sdltest.cpp:(.text+0x30): undefined reference to `Mix_FreeMusic'
sdltest.cpp:(.text+0x34): undefined reference to `Mix_CloseAudio'
sdltest.cpp:(.text+0x40): undefined reference to `TTF_CloseFont'
sdltest.cpp:(.text+0x44): undefined reference to `TTF_Quit'
.objs\sdltest.o: In function `LoadFont(unsigned char)':
sdltest.cpp:(.text+0x8c): undefined reference to `TTF_OpenFont'
.objs\sdltest.o: In function `drawText(SDL_Surface*, char*, int, int, int, int, int)':
sdltest.cpp:(.text+0xe8): undefined reference to `TTF_RenderText_Blended'
.objs\sdltest.o: In function `drawTextInt(SDL_Surface*, int, int, int, int, int, int)':
sdltest.cpp:(.text+0x190): undefined reference to `TTF_RenderText_Blended'
.objs\sdltest.o: In function `TestSDLImage()':
sdltest.cpp:(.text+0x3d0): undefined reference to `IMG_Load'
sdltest.cpp:(.text+0x480): undefined reference to `IMG_Load'
sdltest.cpp:(.text+0x51c): undefined reference to `IMG_Load'
.objs\sdltest.o: In function `TestSDLMixerWAV()':
sdltest.cpp:(.text+0xa54): undefined reference to `Mix_LoadWAV_RW'
sdltest.cpp:(.text+0xa74): undefined reference to `Mix_PlayChannelTimed'
sdltest.cpp:(.text+0xa80): undefined reference to `Mix_Playing'
.objs\sdltest.o: In function `TestSDLMixerOGG()':
sdltest.cpp:(.text+0xb34): undefined reference to `Mix_LoadMUS'
sdltest.cpp:(.text+0xb44): undefined reference to `Mix_PlayMusic'
sdltest.cpp:(.text+0xd30): undefined reference to `Mix_VolumeMusic'
sdltest.cpp:(.text+0xd40): undefined reference to `Mix_PauseMusic'
sdltest.cpp:(.text+0xd4c): undefined reference to `Mix_ResumeMusic'
sdltest.cpp:(.text+0xd58): undefined reference to `Mix_RewindMusic'
sdltest.cpp:(.text+0xdc4): undefined reference to `Mix_VolumeMusic'
sdltest.cpp:(.text+0xdd4): undefined reference to `Mix_PauseMusic'
sdltest.cpp:(.text+0xde0): undefined reference to `Mix_ResumeMusic'
sdltest.cpp:(.text+0xdec): undefined reference to `Mix_RewindMusic'
sdltest.cpp:(.text+0xe08): undefined reference to `Mix_HaltMusic'
.objs\sdltest.o: In function `TestSDLMixerMOD()':
sdltest.cpp:(.text+0xec8): undefined reference to `Mix_LoadMUS'
sdltest.cpp:(.text+0xed8): undefined reference to `Mix_PlayMusic'
sdltest.cpp:(.text+0xee8): undefined reference to `Mix_HaltMusic'
.objs\sdltest.o: In function `main':
sdltest.cpp:(.text+0x104c): undefined reference to `TTF_Init'
sdltest.cpp:(.text+0x1060): undefined reference to `Mix_OpenAudio'
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

go the full hog
-static -lSDL_mixer -lSDL_ttf -lSDL_image -lmikmod -lvorbisidec -lfreetype -ljpeg -lpng12 -lz -lm -lSDL -lpthread

Code:
Directory : D:\GP2X\Test\
--------------------------------------------------------------------------------
Switching to target: default
Compiling: sdltest.cpp
Linking executable: D:\GP2X\Test\test.gpe
C:\DevKitGP2X\lib\libmikmod.a(mdriver.o): In function `MD_DropPrivileges':
mdriver.c:(.text+0x2cf4): warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
Process terminated with status 0 (0 minutes, 2 seconds)
1 errors, 0 warnings
 
That is as good as it gets. The warning does not seem to be important. The binary runs on the hardware.

I just noticed it is being reported as 1 error. I am using Dev c++ and I get that warning but a .gpe is generated and it runs on the GP2X. Does code blocks create an executable ?
 
Okay, that has just confused the crap out of me, to me '1 error' means that hasn't built the program.. but there it is.. cheers for the help, I post a quick setup guide tomorrow when I wake up and then it goes on the Wiki.

You can set Codeblocks a target to build
 
The error is relevant because the corresponding dynamic libc is *not* available at runtime. You should modify the code to not use getpwnam. It's not going to give useful results on the GP2X anyway - all apps run as root.
 
It reads a line from the user list (/etc/passwd), and returns it split into fields - username, password (usually blanked out these days), user/group IDs, home directory, favourite shell, GECOS info (real name, address, phone number)... maybe more that I've forgotten. Not remotely useful on the gp2x. :)

If it's in a lib, that lib ought to be compiled without it for static linking. Not sure what happens if you call it and the runtime version is not available... I guess you could find out, maybe it really is benign. You could also define your own version - then libc's version wouldn't be linked. Just defining 'struct passwd *getpwnam(const char *name)' and returning NULL would probably work ok.

OTOH, if it really isn't a problem at runtime, I guess you can leave it. I hate warnings though, and tend to obliterate them. :)
 
http://wiki.gp2x.org/wiki/Using_CodeBlocks

Title: How to set up DevKitGP2X with CodeBlocks on Windows

Warning: Alpha Text

Step 1: Setting up the compiler

note: Thanks to Guyfawkes for his user guide: http://archive.gp2x.de/cgi-bin/cfiles.cgi?0,0,0,0,23,933

1: Download DevKitGP2X from http://sourceforge.net/project/showfiles.php?group_id=114505
2: Download TheOddBots Soft Float Library from http://wiki.gp2x.org/wiki/Other_Available_Libraries
3: Unzip DevKitGP2X to a directory (usually C:\DevKitGP2X)
4: Unzip the folders from TheOddBot library archive to a temporary location on your computer
5: Copy the following folders from the temporary location to DevKitGP2X folder:
lib
include
man
bin
share
etc
info

These can be found in "/theoddbot-libs-open2x-soft-float\usr\"
If done correctly, Windows should ask if you want to overwrite some folders. Select Yes

Step 2: Installing and Configuring CodeBlocks

1: Download the latest version with MINIGW compiler from http://www.codeblocks.org/downloads.shtml
2: Install and run CodeBlocks
3: Go to Settings -> Compiler
4: Selected Compiler should be on "GNC GCC Compiler", Select Copy and call the new compiler's name "DevKitGP2X"
5: Select Compiler should now be "DevKItGP2X", go to the Directories Tab -> Compiler Tab and remove all directory listings.
6: Click Add and browse (...) to "C:\DevKitGP2X\include" (assuming that DevKitGP2X is on C:). Add another path "C:\devkitGP2X\lib\gcc\arm-linux\4.0.2\include"
7: Go to Directories Tab -> Linker, remove all current listings and Add new path "C:\DevKitGP2X\lib"
8: Go to Programs Tab
9: Change the following:

Compiler's installation directory: C:\DevKitGP2X
C Compiler: arm-linux-gcc.exe
C++ Compiler: arm-linux-g++.exe
Linker for for dynamic libs: arm-linux-g++.exe
Linker for static libs:arm-linux-ar.exe
Debugger: Leave blank
Resource Compiler: Leave blank
Make program: Leave blank

10: Click OK

Step 3: Compilering SDLTest by Guyfawkes

1: Download the source for SDLTest from http://archive.gp2x.de/cgi-bin/cfiles.cgi?0,0,0,0,46,1047
2: Unzip to a directory
3: Create a new directory for your workspace (e.g. NewTest)
4: Transfer sdltest.cpp, sdltest.h and the folder sdltest from SDLTest to NewTest
5: In CodeBlocks, go to Project -> New Empty Project
6: Create .cbp project file in NewTest folder called NewTest.cbp
7: Down the left hand side, you should have a directory tree in the second pane as:
[Home Icon] Default Workspace
[CodeBlocks Icon] NewTest
Right click on "NewTest" and select "Add Files..."
8: Add the files: sdltest.cpp and sdltest.h to the project
9: Select in Codeblocks Project -> Properites -> Targets Tab
10: In the text box for "Output filename", change from NewTest.exe to NewTest.gpe
10 Note: This is to tell the compiler to build a .gpe file rather then .exe when compiling
11: Click "Target's Build Options"
12: Change Selected compiler to DevKitGP2X
13: Select the tab for Linker
14 in the right hand side pane, copy and paste the following text:
-static -lSDL_mixer -lSDL_ttf -lSDL_image -lmikmod -lvorbisidec -lfreetype -ljpeg -lpng12 -lz -lm -lSDL -lpthread
14 Note: Here you are statically linking libraries to the build. e.g. -lSDL means you are adding libSDL to the build.
You do not need to do this step if you are not using any libraries.
15: Click OK and Click OK again
16: Select Build -> Build
17: In the bottom pane you should get something similar to the following warning:

Project : test
Compiler : DevKitGP2X (called directly)
Directory : D:\GP2X\Test\
--------------------------------------------------------------------------------
Switching to target: default
Compiling: sdltest.cpp
Linking executable: D:\GP2X\Test\test.gpe
C:\DevKitGP2X\lib\libmikmod.a(mdriver.o): In function `MD_DropPrivileges':
mdriver.c:(.text+0x2cf4): warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
Process terminated with status 0 (0 minutes, 2 seconds)
1 errors, 0 warnings

This is fine, the cause of this warning can be found in this thread:
http://www.gp32x.de/board/index.php?showtopic=24718

18: You should find NewTest.gpe in your NewTest folder, transfer both sdltest folder (with all the images, files etc and the .gpe to a folder in your memory card for testing.
19: You are now ready to start developing for your GP2X.
 
Last edited by a moderator:
Sorry to bring up a dead topic, but I'm having a bit of trouble with Codeblocks and need a bit of help. I set up my environment similar to the instructions in the wiki (there are a few differences due to me running this on FreeBSD instead of windows, but I've got it set up the same as near as I can tell) but when I try to compile GuyFawkes's SDL test, I get this:

Code:
Project   : test
Compiler  : GP2XDEV (using GNU "make")
Directory : /home/ravnos/sdltest
--------------------------------------------------------------------------------
execvp(-f, /tmp/cbmk3P6d16) failed with error 2!
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

Under directories -> compiler I have /home/ravnos/gp2xdev/lib/gcc/gp2x/4.0.2/include and under directories -> linker I have /home/ravnos/gp2xdev/lib. Under programs I have:
Code:
Compiler's installation directory: /home/ravnos/gp2xdev
C Compiler:              gp2x-gcc
C++ Compiler:            gp2x-g++
Linker for dynamic libs: gp2x-g++
Linker for static libs:  gp2x-ar
Debugger: <blank>
Resource compiler: <blank>
Make program: <blank>

This is all from ooPo's toolchain, btw, and all those exist under /home/ravnos/gp2xdev/bin.

I'm having a bit of trouble finding out what the error from execvp means, since it's not very descriptive. Any suggestions? I'm sure it's a configuration problem, but I'm not sure what's misconfigured.
 
Not 100% but I never used GNU Make in my setup, I just went with whatever CodeBlocks used to invoke the compiler.
 
Well, the "Make program" setting isn't set to anything, so I'm not sure how to get a totally equal configuration here to your Windows setup. I'm guessing it's part of the problem, but I'm not really sure what to look for or where to look for it.

Edit: Shit, found it. Gave me a shit ton of compile errors but at least I know it's working now.

In case anyone else is looking for it, you'll want to go to the Settings menu and open the Compiler settings. Go to the "Other" tab and for the Build method you'll want to select "Invoke compiler directly". I'm probably going to add this to the wiki later but I don't really feel like it right now. At any rate, I'm guessing that setting is set differently in the Windows and *nix versions, which caused a bit of confusion when following directions.
 
Can anyone help me work out WTF is going wrong here?

I am trying to use CodeBlocks, following most of what is explained earlier in this thread. I can code in C#, C++, but come primarily from a Delphi background, where everything is 'done for you'. So as you can imagine, stepping into the wonderful world of linux, compiler options, linking etc is pretty hair raising to say the least >.<

EDIT: I am using the full dev kit by Octoate on the main site.

BUILD LOG

EDIT 2: OK sorted, I had a path set wrong.

This is the new problem:-

Compiling: C:\devkitGP2X\demo\demo.c
Linking console executable: C:\devkitGP2X\demo\demo.exe
ld: crt1.o: No such file: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
 
hmm.. not sure about the crt1.o error but you seem to have missed this part:
3.In the text box for "Output filename", change from NewTest.exe to NewTest.gpe
from Step 3

Can anyone else help to get a/any memory leak detector working on this IDE please? I just spent most of the morning trying to get one working with SDL.
 
Can anyone help with this? I am trying to setup a dev environment using CodeBlocks. I followed the wiki instructions from page 1 of this thread.




I get this error linking:-

Project : SDL Application
Compiler : GP2X Dev Kit (called directly)
Directory : C:\devkitGP2X\NewTest\
--------------------------------------------------------------------------------
Switching to target: default
Compiling: sdltest.cpp
Linking console executable: SDLapp.gpe
c:\devkitgp2x\bin\..\lib\gcc\arm-linux\4.0.2\..\..\..\..\arm-linux\bin\ld.exe: cannot find -lSDL_gfx
Process terminated with status 1 (0 minutes, 3 seconds)
1 errors, 0 warning
 
Back
Top