CFanatic

Go Back   CFanatic > Programming > C Programming

Join CFanatic Forum Now

Compile C code in Linux topic posted under C Programming which is a part of Programming category in CFanatic Forum
Reply
 
Thread Tools Display Modes
  #1  
Old 09-10-2006, 10:24 AM
Junior Member
 
Join Date: Sep 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Tlhokomelo is on a distinguished road
| More
Compile C code in Linux

Please help, I am leaning C on my own so you are my only Hope
I am using that "The C programming Language" E-book but it does not teach how to compile in linux - I was too long ago when those Bell Lab guys wrote it

I am using the GNU gcc compiler, I find it hard to work with it.
Reply With Quote
  #2  
Old 09-12-2006, 07:51 AM
Junior Member
 
Join Date: Sep 2006
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Essial is on a distinguished road
| More
Re: Compile C code in Linux

gcc is pretty easy. Just say "gcc --help" in a graphical console and look at all the options, OR if your in console, pipe the output to less by saying "gcc --help | less" to see all the options. But in general I think, for console apps, I just say "gcc myfile.c -o myapp" or whatnot. Also, if your doing C++ you may be using gpp instead of gcc. Let me know if this doesn't help.
Reply With Quote
  #3  
Old 09-12-2006, 08:57 AM
Junior Member
 
Join Date: Sep 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Tlhokomelo is on a distinguished road
| More
Re: Compile C code in Linux

Thanks Essial
Reply With Quote
  #4  
Old 09-12-2006, 09:02 AM
Junior Member
 
Join Date: Sep 2006
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Essial is on a distinguished road
| More
Re: Compile C code in Linux

Assuming you are new to Linux in general, and also assuming you aren't using Gentoo, you may be unfamiliar with makefiles. Linux has a "make" tool that executes a makefile, which is a glorified batch:

Code:
compile:
  gcc main.c -o app
clean:
  rm app
then you can say "make clean" or "make compile" or whatnot. You may want to read up on this.. its an invaluable tool as far as programming in linux goes.
Reply With Quote
  #5  
Old 09-12-2006, 09:19 AM
Junior Member
 
Join Date: Sep 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Tlhokomelo is on a distinguished road
| More
Re: Compile C code in Linux

Yes I am quite new the programming and I am still in the elementary chapeter of the above book. Your help is highly appreciable.
Reply With Quote
  #6  
Old 11-23-2007, 10:50 AM
Junior Member
 
Join Date: Nov 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Vineel567 is on a distinguished road
| More
Re: Compile C code in Linux

hi......



gcc test.c

will compile ur program and create an executable file named a.out
and run that program by issuing

./a.out
Reply With Quote
Reply

Thread Tools
Display Modes

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
C/Linux/VxWorks Software Engineer - Toronto jsbelanger Looking to hire 1 10-26-2010 05:00 AM
Command Line Compile + Subdirectory DLL Not Working? will C# Programming 1 10-18-2008 09:41 PM
Compile a service with VisualStudio Express Edition Spogliani Win32 Programming 0 08-30-2008 11:33 AM
Need Help Urgently: Unable to Compile C++ michslle C++ Programming 1 06-08-2007 04:13 AM

 

Advertisement

CFanatic Search
Custom Search

Advertisement

All times are GMT -5. The time now is 03:17 PM.



Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO ©2010, Crawlability, Inc.
Cfanatic.com is a premier member of the IDG TechNetwork. For advertising opportunities contact here
Get Paid for Working on Projects Matching Your Expertise at Go4Expert's Jobs Board