LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 04-20-2005, 06:05 AM   #1
node047
LQ Newbie
 
Registered: Mar 2005
Location: india
Posts: 12

Rep: Reputation: 0
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.
 
Old 04-20-2005, 06:19 AM   #2
ahwkong
Member
 
Registered: Aug 2004
Location: Australia
Distribution: Fedora
Posts: 282

Rep: Reputation: 30
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
 
Old 04-20-2005, 11:47 AM   #3
divorce3
Member
 
Registered: Apr 2004
Posts: 33

Rep: Reputation: 15
Compile: gcc -o xxx file.c
Run: ./xxx
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking Programs to the commandline BorgKiller Linux - Software 2 04-05-2005 09:10 PM
linking C++ programs in FreeBSD balasaravanan *BSD 2 11-03-2004 07:36 PM
Question about linking programs Darx Linux - Newbie 5 05-27-2004 06:17 AM
Linking to programs Ben Sytko Linux - Newbie 3 02-26-2003 06:28 PM
compiling and linking boku Programming 5 12-25-2002 09:23 AM


All times are GMT -5. The time now is 11:40 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration