LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   compiling and linking C programs (https://www.linuxquestions.org/questions/linux-general-1/compiling-and-linking-c-programs-315232/)

node047 04-20-2005 06:05 AM

compiling and linking C programs
 
can anyone please tell me how to compile a C program and link to a library which is created by user.

ahwkong 04-20-2005 06:19 AM

To compile, try
Code:

gcc -c <target.cpp> -o <target.o>
To link,
Code:

ld -o <output> <target1.o> <target2.o>
use man to find out more about their command switches

divorce3 04-20-2005 11:47 AM

Compile: gcc -o xxx file.c
Run: ./xxx


All times are GMT -5. The time now is 02:16 AM.