?
Solved

linking two files

Posted on 2008-11-07
4
Medium Priority
?
201 Views
Last Modified: 2012-05-05
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
0
Comment
Question by:kuntilanak
  • 2
  • 2
4 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 22906756
You should use

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

to specify both files when compiling.
0
 

Author Comment

by:kuntilanak
ID: 22906766
ok, what if I want to run test?
0
 
LVL 86

Accepted Solution

by:
jkr earned 2000 total points
ID: 22906793
On the command line, type

./test

That should do it.
0
 

Author Comment

by:kuntilanak
ID: 22906834
gotcha.. thanks!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Suggested Courses
Course of the Month16 days, 15 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question