-
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 http://www.coralquest.com/anagramarama/download.html 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!
Austin
-
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.
Code:
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:
Code:
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.
-
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!
Austin