linking two files

how do I compile the program, say I have a file called test.c, which has:

extern void print_int(int x);
extern void print_str(char x[]);

and the definition of both function is located at a file called print.c

I tried gcc -ansi -Wall test.c testing

but it doesn't work
Who is Participating?
jkrConnect With a Mentor Commented:
On the command line, type


That should do it.
You should use

gcc -ansi -Wall test.c print.c -o test

to specify both files when compiling.
kuntilanakAuthor Commented:
ok, what if I want to run test?
kuntilanakAuthor Commented:
gotcha.. thanks!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.