views:

60

answers:

1

Hi.

I've sort of just finished a mandatory task at school, and I'm about to deliver it.

But then I came across something that was unfamiliar, header files. :(

What I've got:

test-program.c
task_header.h
function1.s
function2.s
function3.s
function4.s

test-program.c:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "task_header.h"
.
..
...

task_header.h:

extern void function1(...);
extern void function2(...);
extern int  function3(...);
extern void function4(...);

And then I use the command:

gcc -m32 -o runtest test-program.c function1.s function2.s function3.s function4.s

Is this a proper way to do it, or is it possible to modify it? So I can type:

gcc -m32 -o runtest test-program.c

?

+2  A: 

That's a perfectly reasonable way to do it.

You'd normally write a makefile as well, so that you can just type make and not have to remember the build instructions. Or, perhaps, just a script so you can do a ./build.sh.

I'll leave those files as an exercise.

Andrew McGregor