1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Dismiss Notice

GP2X Salutations

Discussion in 'General Discussions' started by The Spider Mastermind, Jan 16, 2006.

  1. The Spider Mastermind

    The Spider Mastermind Member

    Joined:
    Jan 16, 2006
    Messages:
    193
    Location:
    Room with no exit
    Hey everyone, guess its finally time to join the forums, had a GP32 for long enough and now the new hurdle is the GP2X, which im actually gonna try code for. I already know the general syntax of C++, yet never have written an app(did an hl2 mod mind...), but I have experience with C# and a lot with VB and Delphi, and a smidge of Assembly. Im confused however as to how to set up visual studio 2003 to compile, the Wiki covers the express 2005, but not Visual C++ 2003(feel free to correct me and scream at me though). Could someone give me a nice little explanation of the settings and build options im going to need?
     
    Tags:
  2. digitaljez

    digitaljez Member

    Joined:
    Jun 1, 2005
    Messages:
    210
    Welcome. Sorry, can't help with Visual C++ 2003. I have manged to set up Bloodshed Dev C++ with devkitpro and SDL and would be happy to help with that if you would consider changing :)
     
  3. The Spider Mastermind

    The Spider Mastermind Member

    Joined:
    Jan 16, 2006
    Messages:
    193
    Location:
    Room with no exit
    Id rather get 2003 running, because im more at home there, but if I cant get it(which is likely), that would be appreciated.

    Edit: Yea, forget it, its being silly, il just use Dev-C++
     
  4. yaustar

    yaustar UK GP32 & GP2X Owner

    Joined:
    Oct 18, 2003
    Messages:
    2,714
    Location:
    UK
    Can't you just create a makefile project instead and use the makefile to compile?
     
  5. The Spider Mastermind

    The Spider Mastermind Member

    Joined:
    Jan 16, 2006
    Messages:
    193
    Location:
    Room with no exit
    Right, trying to compile the demo project gives me "SDL.h: No such file or directory" and consequently a load of errors.
     
  6. timbobsteve

    timbobsteve Member

    Joined:
    Oct 4, 2005
    Messages:
    301
    Then SDL.h (gp2x version) mustn't be in your include path.

    Make sure when using Dev C++ or Vis Studio that you have setup the correct lib/include paths for the compiler.

    Do you have the SDL libraries for the GP2X somewhere on your PC? If not get them and put them somewhere where they are safe and point your compiler to them.

    NOTE: Unless you specifically include the YOUR/PATH/HERE/include/SDL/ directory you will be unable to use '#include "SDL.h" '..... instead use ' #include "SDL/SDL.h". Also make sure your linker is using the correct -l flags:

    e.g. -lSDL -lSDLmain -lSDL_mixer etc. (only include the libs you are using of course) NOTE: -lSDL points to the file ../lib/libSDL.a.... -l is the same as -lib (thought -lib will not work)

    Hope that helps. Welcome to the 2X dev crew. Great to see other C# programmers making the switch to real C/C++ (like I did ;))

    PM me if you need any further help.
     
  7. digitaljez

    digitaljez Member

    Joined:
    Jun 1, 2005
    Messages:
    210
    Assuming you did decide to go with Dev C++ - this worked for me using Guyfawkes' SDL test program.
    Get these two from EvilDragon's file archive :
    Guyfawkes' SDL test program
    Guyfawkes' user guide
    Follow Guyfawkes' User guide 'Developing for the GP2X introduction' (page 33) and confirm you can 'make' his demo from dos. I get 1 warning but the .gpe works on the GP2X.

    In the following description you need to use the path to wherever you have put devkitGP2X, e.g H:\devkitpro\devkitGP2X\ or C:\devkitGP2X\. I shall use ..\devkitGP2X to represent this. Obviously you need to replace the ..\ with the path to your installation.

    In Dev C++, select 'Tools->Compiler options' and add a new compiler by pressing the '+' button and giving it a name ie GP2X.
    Tick the option to add commands to the linker and add the following in the window under it :
    -static -lSDL_mixer -lSDL_ttf -lSDL_image -lmikmod -lvorbisidec -lfreetype -ljpeg -lpng12 -lz -lm -lSDL -lpthread

    Select the directories tab and add ..\devkitGP2X\bin in the binaries tab (remember to replace ..\ with your path ie C:)
    Then add ..\devkitGP2X\lib in the libraries tab
    add ..\devkitGP2X\include and ..\devkitGP2X\include\SDL in the C includes tab
    You are on your own when it comes to C++ (I don't use it) but you might try this in the C++ includes
    ..\devkitGP2X\lib\gcc\arm-linux\4.0.2\include
    ..\devkitGP2X\include\c++\4.0.2
    ..\devkitGP2X\include\c++\4.0.2\arm-linux
    ..\devkitGP2X\include\c++\4.0.2\backward
    ..\devkitGP2X\include
    ..\devkitGP2X\include\SDL

    In the program tab set up the programs as follows :

    Replace the default tools with the arm equivalents in ..\devkitGP2X\bin

    gcc.exe -> arm-linux-gcc.exe
    g++.exe -> arm-linux-g++.exe
    make.exe -> leave alone
    gdb.exe -> leave alone
    windres.exe -> leave alone
    dllwrap.exe -> leave alone
    gprof.exe -> arm-linux-gprof.exe

    When you're done press OK.

    Go to 'File->New->Project'. In the dialogue set the name of your project.
    Select an empty project and press Ok.
    Save the project in a new folder.

    Now copy Guyfawkes' two files into your new project folder (using Windows explorer).
    Go back to Dev C++ and select 'project->add to project'. Select the two files and press open.
    Select 'Project->project options'. Select the compiler tab and choose the new compiler you added earlier.
    Select the build options tab and tick the overide output filename box. change the name so it has a .gpe extension.
    select OK.

    Go to 'Execute->rebuild all'. This will produce a .gpe and, of course, you get the same warning that you get at the dos prompt.

    This builds the project but note there is no call to strip the exe and no compiler parameters are used.

    Copy the .gpe and the folder in Guyfawkes' SDL test project to your SD card.

    If you use this and it works for you too, let me know and I will try and get the Wiki updated, as the instructions there did not work for me. If you can add anything like compiler options, make file extensions, confirm/correct the c++ libraries etc, or know a better way of doing things we can add that to the wiki as well.
     
    Last edited by a moderator: Dec 19, 2015
  8. The Spider Mastermind

    The Spider Mastermind Member

    Joined:
    Jan 16, 2006
    Messages:
    193
    Location:
    Room with no exit
    C:/devkitGP2X/bin/arm-linux-g++ -static -o demo.gpe demo.o `C:/devkitGP2X/bin/arm-linux-sdl-config --libs`
    c:\devkitgp2x\bin\..\lib\gcc\arm-linux\4.0.2\..\..\..\..\arm-linux\bin\ld.exe: cannot find -lSDL_ttf
    make: *** [demo.gpe] Error 1

    Help?
     
  9. luteijn

    luteijn Member

    Joined:
    Dec 23, 2005
    Messages:
    159
    Location:
    The Hague, NL
    These questions seem to come again and again, it's not a gp2x development issue, but a general question on how to compile a program. It is answered all over the internet, e.g.http://galton.uchicago.edu/~gosset/Compdocs/
    http://www.muppetlabs.com/~breadbox/softwa...iny/teensy.html

    or buy/borrow a book like http://www.network-theory.co.uk/gcc/intro/


    That said, here's something to start you off.

    Compare the output of
    Code:
    C:/devkitGP2X/bin/arm-linux-sdl-config --libs
    with where your SDL_ttf lives. probably it's installed somewhere else, (if at all)

    Anyway, when you're just compiling your first few programs, might as well put the -I -L -l etc. in yourself instead of relying on things you don't understand (yet). Don't jump in at the deep end by using `` make etc. !



    P.
     
  10. The Spider Mastermind

    The Spider Mastermind Member

    Joined:
    Jan 16, 2006
    Messages:
    193
    Location:
    Room with no exit
    Thanks for being so helpful everyone, but alas, no demo! Doing arm-linux-sdl-config --libs gives:
    -LC:/devkitGP2X/lib -Wl,-rpath,C:/devkitGP2X/lib -lSDL --start-group -lSDL_ttf -lfreetype -lSDL --end-group -lSDL_image -ljpeg -lpng12 -lz --start-group -lSDL_mixer -lvorbisidec -lmikmod -lSDL --end-group -lgcc -lm -lc -lexpat -lpthread -ldl

    And after poking around, i could not find SDL_ttf. So i figured recompiling with the -I -L -l parameters may yet save the town, yet still produces the same error as my last post. Any ideas?
     
  11. luteijn

    luteijn Member

    Joined:
    Dec 23, 2005
    Messages:
    159
    Location:
    The Hague, NL
    Last edited by a moderator: Dec 19, 2015
  12. The Spider Mastermind

    The Spider Mastermind Member

    Joined:
    Jan 16, 2006
    Messages:
    193
    Location:
    Room with no exit
    Boohyea, compiled and ran perfectly, no warnings at all. Il still need to fiddle about with the IDE's and such to get everything ironed out, but at least the damn thing compiles! Thanks a lot! Mind, that was actually easier than I expected.
     
  13. digitaljez

    digitaljez Member

    Joined:
    Jun 1, 2005
    Messages:
    210
    Did you not try Guyfawkes' User guide instructions ? They explain where to get, and how to set up the toolchain and the SDL libs. Also it provides a good SDL test program with a make file. Worked straight off for me - highly recommended. Thank you Guyfawkes ! If you did follow the guide, the file you are looking for is libSDL_ttf.a in \devkitGP2X\lib if that is any help.
     
  14. The Spider Mastermind

    The Spider Mastermind Member

    Joined:
    Jan 16, 2006
    Messages:
    193
    Location:
    Room with no exit
    I did. That was the first thing I did. It didnt seem to be in the libs i got from the link in the user guide. Either that, or my rapant attempts to get it to work diluted it from existance. And the thing I got to compile was the demo linked from the user guide.
     

Share This Page

Loading...