Thread: Compiling Anagramarama

  1. #1
    Registered User
    Join Date
    Jan 2007

    Compiling Anagramarama

    I don't know much about programming in C--I've written a few pretty basic programs for a college course, but nothing intense. I wanted to tinker around with Anagramarama, a free (GPL'd) game, so I downloaded the source code from and I tried to compile it with gcc (I'm running Ubuntu Edgy) and got a bunch of errors. I've never compiled programs from multiple files, so I was just wondering if anybody could tell me what I'm doing wrong. Here's an example of me trying (and failing miserably) to compile it:

    austin@austin-laptop:~/downloads/anagramarama/src$ ls
    ag.c ag.h dlb.c linked.c sprite.c sprite.h
    ag.c~ cvs dlb.h linked.h sprite.c~ sprite.h~
    austin@austin-laptop:~/downloads/anagramarama/src$ gcc -o anagramarama ag.c dlb.c linked.c sprite.c
    ag.c:61:21: error: SDL/SDL.h: No such file or directory
    ag.c:62:27: error: SDL/SDL_mixer.h: No such file or directory
    In file included from ag.c:67:
    sprite.h:33: error: expected specifier-qualifier-list before ‘SDL_Surface’
    sprite.h:43: error: expected ‘)’ before ‘*’ token
    sprite.h:44: error: expected ‘)’ before ‘*’ token
    sprite.h:45: error: expected ‘)’ before ‘*’ token
    sprite.h:46: error: expected ‘)’ before ‘*’ token
    sprite.h:47: error: expected ‘)’ before ‘*’ token
    ag.c:100: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

    and the errors go on for about twice as long, but I figured that this is a fair example of what's going on. That first error message looks like it's not finding some .h files, right? Do I need to download those from somewhere or just fix my PATH variable or what? Any help would be greatly appreciated. Thanks!


  2. #2
    Registered User
    Join Date
    Sep 2001
    SDL is a programming interface for games which this program apparently uses. Make sure you've installed the SDL package through package manager.

    The make utility is generally what you want to use for something like this.
    questionc@mercury ~/anagramarama
    $ make
    This will read the makefile and compile according to the rules in there.

    If you want to manually compile, here's the command line:
    gcc -Wall `sdl-config --cflags --libs` -funroll-loops -fomit-frame-pointer -pipe -O9 -lSDL_mixer-o anagramarama ag.c dlb.c linked.c sprite.c
    A lot of those options are probably not strictly neccesary.
    Callou collei we'll code the way
    Of prime numbers and pings!

  3. #3
    Registered User
    Join Date
    Jan 2007

    Working now

    Ah yes, the make command is a big help. Also, I thought I had the SDL files, but apparently not. Found them pretty easily, and now its all good. Thanks!


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie Compiling Problem
    By Deronius in forum C++ Programming
    Replies: 3
    Last Post: 06-15-2008, 11:23 AM
  2. Problem compiling files that store functions
    By tiachopvutru in forum C++ Programming
    Replies: 10
    Last Post: 05-30-2008, 05:42 PM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. Compiling
    By Dae in forum C++ Programming
    Replies: 7
    Last Post: 06-15-2005, 01:08 AM
  5. compiling and executing issue with lcc win32
    By GanglyLamb in forum C Programming
    Replies: 10
    Last Post: 12-22-2004, 02:24 PM