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
kuntilanakAsked:
Who is Participating?
 
jkrConnect With a Mentor Commented:
On the command line, type

./test

That should do it.
0
 
jkrCommented:
You should use

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

to specify both files when compiling.
0
 
kuntilanakAuthor Commented:
ok, what if I want to run test?
0
 
kuntilanakAuthor Commented:
gotcha.. thanks!
0
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.