GP2X Dotnet 2003


MadDog

Member
Joined
Mar 4, 2006
Messages
262
Age
55
Location
UK
Website
www.maddoggames.com
This is a short doc on some stuff i've done to get GCC compiling for me in dotnet. Its not perfect, theres prob a better way of doing it. I looked at doing a plugin but the API is hell!

So, here goes.


First you need to add the path to gcc.exe and the tools it calls to the VC++ directories.

tools->options->Projects->VC++ Directorys.

Mine are...

C:\devkitGP2X\arm-linux\bin
C:\devkitGP2X\bin
C:\devkitGP2X\minsys\bin
C:\devkitGP2X\libexec\gcc\arm-linux\4.0.2

Ok, thats the global one time setup stuff done. Now lets set up the project.
Make a win32 project, but setting it to be empty.

Now that is done, you need to setup the source files. I've done a bit of work to find a way where the custom command can be cut'n'paste when you add files.

Get the properties page open for the sourcefile and set the tool to "Custom Build Tool". Press the apply button. This will now have changed the dialog and you should now only have the Custom Build Step option.

Go to this page and in the command line type the following $(ProjectDir)build_file.bat $(InputPath) $(OutDir)\$(InputName).o

In the Outputs add "$(OutDir)\$(InputName).o" This is needed so that the compile otion is active for the source file.

You may want to clear the discription field, don't want that on every source file.

Now you need to make a batch file for calling GCC, its in here that your add you include dirs for the project and global defines.
I've done it like this as dev as far as I can see has no enviroment var for these project settings. No big deal though.

In the batch file your need at least "arm-linux-gcc %1 -c -o %2", you may want to add "echo %1" as the first line.
The %1 is the first param to the batch file, remember that on the file dev is calling $(ProjectDir)build_file.bat $(InputPath) $(OutDir)\$(InputName).o
So the %1 is changed to the name of the source file. %2 is where the object file goes. Done so that dev can see if the file is upto date, if it is then the file is not compiled.

None of the enviroment varibles for system includes were setup on my system, so i've had to set them up. I've used CPATH,
not sure if thats the correct one. Could have added them with the -I option in my batch file but if I got a new compiler version i'll be a bit stuck having to fix all the bat files for my projects.

Mine is set to....

C:\devkitGP2X\include;C:\devkitGP2X\include\c++\4.0.2\arm-linux;C:\devkitGP2X\include\c++\4.0.2;C:\devkitGP2X\include;C:\devkitGP2X\include\sdl;C:\devkitGP2X\sysroot\usr\include;C:\devkitGP2X\lib\gcc\arm-linux\4.0.2\include

Little note, dotnet will not know about any changes without it being shutdown then restarted.

Now this is done we need to link all the object files, this is done with one setting for the whole project.

Go to the Project "Property pages" dialog and the builds event page. On the Post-Build Event command line add

arm-linux-gcc $(OutDir)\*.o -o $(ProjectName).gpe -BC:\devkitGP2X\lib -static -lstdc++ -lSDL_image -ljpeg -l png12 -lz -lpthread -lSDL_mixer -lvorbisidec -lmikmod -lSDL -lSDL_ttf -lfreetype -lm -lsmpeg -ldl -lSDL -lpthread

May want to change the deiscription box to Linking. Just so you know what its doing.

And that 'should' work.
 
Once confrimed can you add it to the wiki? IT be pretty handy to a lot of people.
 
slygamer posted on Apr 29 2006 at 03:07 PM said:
If using VS2005, you should read the wiki article that goes into great detail on how to use it for GP2X development.
I've been though that a couple of times, can't seem to get it working with the test projects, still not sure what I'm doing wrong though (error messages escape me at the moment)... Going to try again after Dr Who I think.
I have VS2003 on here as well (work reasons!) so I can test out Maddogs process anyway :)
 
Last edited by a moderator:
A little tweek to calling the batch files.

Change
$(ProjectDir)build_file.bat $(InputPath) $(OutDir)\$(InputName).o

To

$(ProjectDir)build_file.bat $(InputPath) $(IntDir)\$(InputName).o

Changed %(OutDir) to %(IntDir) OutDir is where the finished product goes, like a lib. And %(IntDir) is the intermediate dir.
 
slygamer posted on Apr 30 2006 at 10:27 AM said:
Try it again and copy the error messages into here. I should be able to help you.
Thanks, as soon as I get a chance I'll do that...
Did a little something to my back so I'm trying to catch up with everything at the moment!
 
Last edited by a moderator:
The existing Wiki on VS2005 is incorrect as relating to the given arm-linux-gcc command-line. You have to move the 'input files' macro to just after the -c flag and it works correctly.

Ive been developing with VS2005 for a while now and it works great - the nice thing is using sed allows the error messages to show up in 'task lists' and also support double-click to jump to the error location in the source file.
 
Yer, I had some pain setting it up, although not had to change the rule, the one I have is the same as the Wiki one and works. The only prob I had was some confusion on my part. :rolleyes:

Kind of made my 2003 post crash and burn. :p
 
MadDog posted on May 8 2006 at 11:20 AM said:
Yer, I had some pain setting it up, although not had to change the rule, the one I have is the same as the Wiki one and works. The only prob I had was some confusion on my part. :rolleyes:

Kind of made my 2003 post crash and burn. :p


Onnos!

So what did you do to get it to work as-per-wiki? Im a fool when it comes to gcc so maybe I did something wrong thus forcing me to change the build rules.. Im always wanting to learn, so if you can explain that then that would be great!

Cheers.

Jet-Set-Matt
 
Last edited by a moderator:
I cut and paste the text into a file and used that nothing more. Prob better to say what I did to break it. I had a lib that had a 'link' file as well as a 'ar' file in it. Also my link order was incorrect.

Here is the cmd line to my app, so you can check it against yours.

This one is for the source files.
arm-linux-gcc.exe -c -I"..\..\k9\include" -I"..\..\k9\include\gp2x" -DGP2X -D_DEBUG -o Debug\cube.o 2>&1 | sed -e s/(.[a-zA-Z]\+):([0-9]\+):/\1(\2):/

This is the link one.
arm-linux-gcc.exe Debug\*.o -o "c:\GP2X\projects\samples\cube\Debug\cube.gpe" -L"C:\devkitGP2X\lib" -L"C:\GP2X\projects\K9\lib\debug" -lK9d -lstdc++ -static 2>&1 | sed -e s/(.[a-zA-Z]\+):([0-9]\+):/\1(\2):/
 
Last edited by a moderator:
Back
Top