LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-11-2005, 02:43 AM   #1
fastian
LQ Newbie
 
Registered: Jan 2005
Location: karachi
Posts: 4

Rep: Reputation: 0
Question command for compling C code in linux


HI ,

Thanks alot for my help in locating the source code of ping in the linux system ...... well i have downloaded iputils folder from net and now its time for it to be compile on linux system ... as u know that code is in C langauge so i will like to ask for the method how to compile it on linux system ...

i have come to know that GCC filname this command will do compilation of the source code ......do guide we in this regard .....tell me the command both in REDHAT and NOVELL


waiting for ur replies
fastian
 
Old 02-11-2005, 03:52 AM   #2
BinaryBob
Member
 
Registered: Aug 2002
Posts: 117

Rep: Reputation: 15
If you are compiling code that you downloaded as a package, usually you can do:
Code:
#> ./configure
#> make
#> make install
And that will configure, compile, and install the software pack you downloaded. However if you just have a single C file that you downloaded, or wrote yourself and you want to compile then the command you want is:
Code:
#> gcc <source.c> -o <binary>
NOTE: the above command doesn't bring in any additional libraries or anything

Of course you replace <source.c> with the name of the source file and <binary> with the name you want for the binary, once it is compiled.

Hope this helps!
 
Old 02-15-2005, 01:39 AM   #3
fastian
LQ Newbie
 
Registered: Jan 2005
Location: karachi
Posts: 4

Original Poster
Rep: Reputation: 0
Thumbs up thanks for the command info

Hi,

well that was helpful indeed i will like to know what if we want to compile .C files which has many headers files included in it ......what GCC command should we use for that ...??????
 
Old 02-15-2005, 05:57 AM   #4
Chaitanyayardi
LQ Newbie
 
Registered: Jul 2004
Posts: 15

Rep: Reputation: 0
Hello,
When you are giving .C extension that c is capital it means it is C++ file and when you are specifying .c extension it mean c file. You can compile any c or C++ file using below command
gcc test.C -o test.o
or for C file
gcc test.c -o test.o

if you will not provide -o test.o the object file then default object file will be created ie a.out
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C program code to execute linux-command supermichou_fr Linux - Software 4 08-01-2012 08:25 AM
c code from windows to linux - wich command? kotoko Linux - Newbie 2 10-09-2005 10:14 PM
how to invoke a linux command inside a java code ? kusum Linux - Software 2 11-23-2003 01:19 PM
C program code to run a Linux command line Linh Programming 10 06-11-2003 01:59 PM
C program code calling a Linux system command Linh Programming 1 06-05-2003 01:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration