Compiling on Linux

How would you compile a SDL app using gcc with just 1 main.c files?

I tried gcc -o main main.c but I get errors, not sure what the linking
argument is to link to libsdl.

-Josh

gcc -o main main.c sdl-config --cflags --libs

…I believe.On Thu, Jun 28, 2007 at 02:44:30PM -0400, Joshua Shriver wrote:

How would you compile a SDL app using gcc with just 1 main.c files?

I tried gcc -o main main.c but I get errors, not sure what the linking
argument is to link to libsdl.


-bill!
bill at newbreedsoftware.com
http://www.newbreedsoftware.com/

Thanks that worked. :slight_smile: How do you use sprite maps? Where you have a
bunch of sprite frame in a single image.

-JoshOn 6/28/07, Bill Kendrick wrote:

On Thu, Jun 28, 2007 at 02:44:30PM -0400, Joshua Shriver wrote:

How would you compile a SDL app using gcc with just 1 main.c files?

I tried gcc -o main main.c but I get errors, not sure what the linking
argument is to link to libsdl.

gcc -o main main.c sdl-config --cflags --libs

…I believe.


-bill!
bill at newbreedsoftware.com
http://www.newbreedsoftware.com/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I don’t, typically. But if it’s a simple tile map (e.g., each 'sprite’
on the map is the same size and distance from each other… a good example
would be a monospaced font), you just SDL_BlitSurface() from various
positions from your source surface onto your target surface.

Kinda beyond the scope of this mailing list, though…

-bill!On Thu, Jun 28, 2007 at 03:05:12PM -0400, Joshua Shriver wrote:

Thanks that worked. :slight_smile: How do you use sprite maps? Where you have a
bunch of sprite frame in a single image.

what about compiling 2 or more files, is it the same with just more files?

Time to learn how to program C. :slight_smile: Use Google, buy a book, grab some
example code (e.g., existing games, tutorials, etc.) This is getting way
off-topic from this list.

Quick summary, though:

gcc file.c -c -o file.o sdl-config --cflag
gcc file2.c -c -o file2.o sdl-config --cflags
gcc file.o file2.o -o program sdl-config --cflags --libs

Better would be to have a Makefile and use ‘make’ appropriately, of course.
(O’Reilly’s “Managing Projects with Make” is a good read, for example.)On Sat, Jun 30, 2007 at 12:36:49AM -0500, Jonathan Greig wrote:

what about compiling 2 or more files, is it the same with just more files?


-bill!
bill at newbreedsoftware.com
http://www.newbreedsoftware.com/