Thursday, July 20, 2006

Let the Games Begin....or at least compile....


Hello All,

Welcome to yet another of my word dumps. For those of you new to my writings I am a developer who likes to do different things and I tend to write about those things and see if anyone can "one up" me.

This is the latest wordcast blog I have started and it will focus purly on the GP2X (really check the link if you dont know what it is). For the lazy clickers out there its a personal media system. It plays games, movies, mp3s, books etc. but its open source and very cool.

Step 1 - Get the things that allow you to compile programs for the system:

A (lazy person's guide): Prebuilt developer package

If you use Windows 2K or Windows XP and just want a quick set-up, you can use this section to get a minimum developer system:

Two options are available:

1. The Gamepark Holdings Software Developer's Kit available from Gamepark at http://dev.gp2x.com/sdk/gp2xsdk_windows.zip

This kit includes the Bloodshed devC++ integrated development environment, GCC versions for both gp2x native and MS-Windows native executables, and copies of the Linux version 2.4.25 libraries. It will compile gp2x native code for executables using shared libraries in addition to the static library form.

2. The devkitGP2X described below.

  • Download: gp2x devpack (31.1MB). Unzip the devkitGP2X directory into your root directory. It contains the latest development libraries (hardware accelerated SDL, Allegro, etc).
  • If you chose a development directory other than \devkitGP2X, you will need to correct the paths in bin\arm-linux-sdl-config and demo\Makefile.
  • Add the bin directories to your path. Click on Start->Settings->Control Panel, open System->Advanced->Environmnet Variables, select PATH and add C:\devkitGP2X\bin;C:\devkitGP2X\minsys\bin; to your path.
  • This set-up includes devkitGP2X (cross compiler tools), SDL (library), MinSys (make and GNU commands). It does not include a debugger or a Windows compiler.
  • To test your setup, run a Demo Program

Krispy Note: DONT FUCK WITH THE SUGESTED PATH!!! If you do then you will have problems. Trust me I spent 3 days trying to get stuff to compile and it turned out to be the dam directories. Also make sure you dont have devkitXXX installed where XXX is any other gba or arm dev kit. Unistall that devkit if you have it on your system.

Step 2 - Use good tools

Now, there is a tool that comes with the sdk (C:\GP2XSDK\devcpp.exe :: on windows [if you put it somewhere else then your on your own]) this is actually a decent IDE and its already set up for development of GP2X games. Its great to play with when you are waiting for your GP2X to arrive in the mail. But its editor is too frustrating for me so I setup Eclipse 3.2 (Callisto) to be my ide of choice for GP2X development.

Krispy Note: If you can't get the DevC++ ide to compile your code or even the code that it auto generates then you did something wrong when you unzipped the sdk and gpx files. DO IT AGAIN and put them in the correct directories ( mine are: C:\GP2XSDK and C:\devkitGP2X ) also make sure your path has the correct info: ( C:\GP2XSDK\bin;C:\devkitGP2X\bin;C:\cygwin\bin; ) I have cygwin installed so that my compiled programs actually run in windows. If you dont have the cygwin dlls in your runtime dirs then you should install cygwin.

3. Setting up eclipse:

Here is the correct output from DevC++ when compiling and running:

Compiler: win
Building Makefile: "C:\GP2XSDK\Projects\TicTakToe\Makefile.win"
Executing make...
make.exe -f "C:\GP2XSDK\Projects\TicTakToe\Makefile.win" all
cygwin-mkdir -p "win"

g++.exe -c main.c -o win/main.o -I"C:/GP2XSDK/include/GP2X" -I"C:/GP2XSDK/include/SDL" -I"C:/GP2XSDK/lib/gcc/mingw32/3.4.2/include" -I"C:/GP2XSDK/include/c++/3.4.2/backward" -I"C:/GP2XSDK/include/c++/3.4.2/mingw32" -I"C:/GP2XSDK/include/c++/3.4.2" -I"C:/GP2XSDK/include" -DWIN32

g++.exe win/main.o -o TicTacToe.exe -L"C:/GP2XSDK/lib" -lmingw32 -liconv -lgp2x -lSDL_image -lSDL_mixer -lSDL_ttf -lSDL_inifile -lSDLmain -lSDL -lpng -ljpeg -lvorbisidec -lmad -lfreetype -lz -lunicodefont

Execution terminated
Compilation successful

Ok so I added some color to help explain what you need to do:

Open Eclipse and set your perspective to the CDT perspective (if you dont have CDT installed as a plugin then get the update from eclipse using the update procedure:: if you dont know how to do that then look it up using google or read the eclipse tutorials on installing a plugin)

Now create a new "Managed Make C++ Project" (again read up on eclipse CDT to find out more). So you have a project yay! Now left click the project so its selected. Now right click the project and open its properties dialog. Now on the left there is a list of things...click on "C/C++ Build". There are two configuration types "Release" and "Debug" you should set this up for both or it will compile for one and not the other. So I'll assume you have Debug selected as that seems to be the default:

Under the GCC C++ compiler we need to add some info to "directories" so go ahead and select that one. Add all the include paths that are in blue as shown above: NOTE::click the add button and enter them like the following (no quotes) "C:/GP2XSDK/include/GP2X" do that for all of the blue entries above.

After you have all of those done, select "GCC C++ Linker" and for "Libraries" add all the purple ones (no quotes) "mingw32" etc.

Under the Library search path add "C:/GP2XSDK/lib"

Remember to set this up for both Release and Debug

Also you could add (under preprocessor of the compiler) "Defined Symbols" add "WIN32"

Then you should be able to compile any GP2X example code (Try coping over the generated one from DevC++ and compile that).

Leave a comment if was helpful at all to you.

7 Comments:

Blogger Doug Schaefer said...

Very cool. I've just run accross this whole GP2X phenomenon and was glad to see your post on using the Eclipse CDT for this. I've just mentioned it in my blog over at http://cdtdoug.blogspot.com.

11:32 AM  
Blogger Pick 3 Turbo Player said...

Nice blog!

If you get a chance, check out my site: Pick 3 Turbo Player

Thanks

10:52 PM  
Blogger Great Future said...

Unlimited Earnings Potential - http://1greatfuture.com

Our company is rapidly growing and offers you an extraordinary income helping others succeed. The primary requirement is to follow up on client inquiries and point them in the right direction. It is stress free, rewarding and straightforward work.

For complete details: http://1greatfuture.com


(Please feel free to delete this post if you don't want it on your blog. Thanks for the informative blog and opportunity to post.)

8:05 PM  
Blogger milf said...

find air beds in wisconsinbest air beds in wisconsincloud air bedsbest cloud inflatable air bedssealy air beds portableportables air bedsrv luggage racksaluminum made rv luggage racksair bed raisedbest form raised air bedsbed air informercialsbest informercials bed airmattress sized air bedsbestair bed mattress antique doorknobsantique doorknob identification tipsdvd player troubleshootingtroubleshooting with the dvd playerflat panel television lcd vs plasmaflat panel lcd television versus plasma pic the bestadjustable bed air foam The best bed air foam hoof prints antique equestrian printsantique hoof prints equestrian printsBuy air bedadjustablebuy the best adjustable air bedsair beds canadian storesCanadian stores for air bedsmigraine causemigraine treatments floridaflorida headache clinicdrying dessicantair drying dessicant

3:54 PM  
Blogger milf said...

black mold exposureblack mold symptoms of exposurewrought iron garden gatesiron garden gates find them herefine thin hair hairstylessearch hair styles for fine thin hairnight vision binocularsbuy night vision binocularslipitor reactionslipitor allergic reactionsluxury beach resort in the philippinesafordable beach resorts in the philippineshomeopathy for eczema.baby eczema.save big with great mineral makeup bargainsmineral makeup wholesalersprodam iphone Apple prodam iphone prahacect iphone manualmanual for P 168 iphonefero 52 binocularsnight vision Fero 52 binocularsThe best night vision binoculars herenight vision binoculars bargainsfree photo albums computer programsfree software to make photo albumsfree tax formsprintable tax forms for free craftmatic air bedcraftmatic air bed adjustable info hereboyd air bedboyd night air bed lowest price

3:55 PM  
Blogger milf said...

new houston house houston house txstains removal dyestains removal clothesstains removalteeth whiteningteeth whiteningbright teethjennifer grey nosejennifer nose jobscalebrities nose jobsWomen with Big NosesWomen hairstylesBig Nose Women, hairstyles

3:55 PM  
Blogger milf said...

dessicant air dryerpediatric asthmaasthma specialistasthma children specialistcarpet cleaning dallas txcarpet cleaners dallascarpet cleaning dallasvero beach vacationvero beach vacationsbeach vacation homes veroms beach vacationsms beach vacationms beach condosmaui beach vacationmaui beach vacationsmaui beach clubbeach vacationsyour beach vacationscheap beach vacationsbob hairstylebob haircutsbob layeredpob hairstylebobbedclassic bobCare for Curly HairTips for Curly Haircurly hair12r 22.5 best pricetires truck bustires 12r 22.5washington new housenew house houstonnew house san antonionew house ventura

3:55 PM  

Post a Comment

<< Home