Problem With Sdltest-thingy


grgry

Still Fresh
Joined
Jan 14, 2006
Messages
28
Hi everybody,

first of all i'm a beginner in C++-programming and getting my GP2X gave me the final reason to start learning it.

anyway, I have a little problem with the guyfawkes sdltest:

I have all set up exactly according to the Wiki using Codeblocks (even did the setup twice) but it doesn't compile the sdltest, since it seems some path-setting is not correct.

Project : Untitled1
Compiler : DevKitGP2X (called directly)
Directory : C:\gp2x\sdltest-v121\sdltest\
--------------------------------------------------------------------------------
Switching to target: default
Compiling: ..\sdltest.cpp
..\sdltest.cpp:22:17: error: SDL.h: No such file or directory
..\sdltest.cpp:23:21: error: SDL_ttf.h: No such file or directory
..\sdltest.cpp:24:23: error: SDL_image.h: No such file or directory
..\sdltest.cpp:25:23: error: SDL_mixer.h: No such file or directory

..and lots of other errors regarding the missing headers

I'm able to compile it, if I change

#include "SDL.h" to
#include "SDL/SDL.h"
etc.

maybe someone can tell me, where i have to include the missing path...

thanks
 
um, forgot to mention that for my second setup i followed the user_guide_1.4 and used the oddbot_SDL libs from the archive.

same problem though ;)
 
Hi there,
I think you would need to add SDL/ onto the end of the includes line in the arm-linux-sdl-config file. (Located in your devkitGP2X/bin directory)

Code:
 includes=-I${prefix}/include/SDL/

That works.

Chimpoid.
 
thanks for the tip, unfortunately still no success.
same problem as before.
Maybe you got another idea, if not, guess I try another setup.

here's how I changed the arm-linux-sdl-config in the c:\devkitGP2X\bin (as I understood it, just added the mentioned SDL/ ):

Code:
#!/bin/sh

prefix=C:/devkitGP2X
exec_prefix=${prefix}
exec_prefix_set=no

usage="\
Usage: sdl-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs]"

if test $# -eq 0; then
      echo "${usage}" 1>&2
      exit 1
fi

while test $# -gt 0; do
  case "$1" in
  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`;;
  *) optarg=;;
  esac

  case $1 in
    --prefix=*)
      prefix=$optarg
      if test $exec_prefix_set = no; then
        exec_prefix=$optarg
      fi
     ;;
    --prefix)
      echo $prefix
     ;;
    --exec-prefix=*)
      exec_prefix=$optarg
      exec_prefix_set=yes
     ;;
    --exec-prefix)
      echo $exec_prefix
     ;;
    --version)
      echo 1.2.9
     ;;
    --cflags)
      echo -I${prefix}/include/SDL  -D_REENTRANT

      # The portable way of including SDL is #include "SDL.h"
      if test ${prefix}/include != /usr/include; then
      #    # Handle oddities in Win32 path handling (assumes prefix)
          prefix=`echo ${prefix} | sed 's,^//([A-Z]),\1:,'`
      #
          includes=-I${prefix}/include/SDL/
      fi
      echo $includes -I${prefix}/include/SDL  -D_REENTRANT
     ;;
#    --libs)
#      libdirs="-L${exec_prefix}/lib -Wl,-rpath,${exec_prefix}/lib"
#      echo $libdirs -lSDL -lSDL_image -ljpeg -lpng12 -lz -lzip -lSDL_ttf -lfreetype -lgcc -lexpat -lpthread
#     ;;
#    --static-libs)
    --libs|--static-libs)
      libdirs="-L${exec_prefix}/lib -Wl,-rpath,${exec_prefix}/lib"
      #best echo $libdirs -lSDL -lSDL_image -ljpeg -lpng12 -lz -lzip --start-group -lSDL_ttf -lfreetype -lSDL --end-group -lgcc -lm -lc -lexpat -lpthread -ldl
      echo $libdirs -lSDL -lSDL_gfx --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
     ;;
    *)
      echo "${usage}" 1>&2
      exit 1
     ;;
  esac
  shift
done
 
Last edited by a moderator:
ok, removed Codeblocks and went with Dev-C++ (i like using it a lot more than Codeblocks - thanks yoyoyo...)


same problem till i found this :

Anyway.. The only way I can get a clean compile with DevCPP is to set the flag to make it use my own makefile which I created using the sdltest makefile as the template.
did that, compiled, no errors, happy.


thanks all for helping out
 
Last edited by a moderator:
wanted to know what the problem was and tried your way, works also.
this way Dev-C++ can create the makefile.
even no need to set a path to the includes/SDL dir in the compiler options (as suggested).

found out that it basically comes down to the linker switches, so if I follow the guide and add the linker switches in the project options as mentioned in the other thread:

-static -lSDL -lSDL_image -ljpeg -lpng12 -lz -lpthread --start-group -lSDL_mixer -lvorbisidec -lmikmod -lSDL --end-group --start-group -lSDL_ttf -lfreetype -lm -lSDL --end-group

it works.

maybe worth an update in the wiki, but since i'm not so good at this yet, i'm not sure if that's right for everybody...
 
Is it really not possible to just put `sdl-config --libs` instead of listing all the libraries? I thought that was the whole point of the config script.
 
The Wiki installation for codeblocks does not use the arm-linux-sdl-config file to compile. If you want to include the header files, you have to change the source files to look in the right directory (#include "./sdl/sdl.h" ), move the headers out of the SDL folder and into the 'include' root directory or set up the project up to look for headers in the 'include/sdl' directory as well.
 
Back
Top