Compile C code in Linux

Reply

Join Date: Oct 2004
Posts: 19
Reputation: Tlhokomelo is an unknown quantity at this point 
Solved Threads: 1
Tlhokomelo's Avatar
Tlhokomelo Tlhokomelo is offline Offline
Newbie Poster

Compile C code in Linux

 
0
  #1
Sep 4th, 2006
Please help, I am leaning C on my own so you are my only Hope :o
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 :rolleyes: when those Bell Lab guys wrote it :cry:

I am using the GNU gcc compiler, I find it hard to work with it.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 275
Reputation: andor has a spectacular aura about andor has a spectacular aura about andor has a spectacular aura about 
Solved Threads: 29
andor's Avatar
andor andor is offline Offline
Posting Whiz in Training

Re: Compile C code in Linux

 
1
  #2
Sep 4th, 2006
type gcc programName.c -o programName -Wall
and then to execute
./programName
-Wall is optional
Last edited by andor; Sep 4th, 2006 at 11:14 am.
If you want to win, you must not loose (Alan Ford)
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 19
Reputation: Tlhokomelo is an unknown quantity at this point 
Solved Threads: 1
Tlhokomelo's Avatar
Tlhokomelo Tlhokomelo is offline Offline
Newbie Poster

Re: Compile C code in Linux

 
1
  #3
Sep 5th, 2006
Hey andor thank you - I've been recompiling my code in gcc so I may use the programs in Linux now, thanx again

If I may ask, do I use the same process to compile cpp code? Please don't say "RTFM!" It is a bit complicated - I'm new to this Linux Programming thing
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 275
Reputation: andor has a spectacular aura about andor has a spectacular aura about andor has a spectacular aura about 
Solved Threads: 29
andor's Avatar
andor andor is offline Offline
Posting Whiz in Training

Re: Compile C code in Linux

 
1
  #4
Sep 5th, 2006
Originally Posted by Tlhokomelo View Post
Hey andor thank you - I've been recompiling my code in gcc so I may use the programs in Linux now, thanx again

If I may ask, do I use the same process to compile cpp code? Please don't say "RTFM!" It is a bit complicated - I'm new to this Linux Programming thing
No. Istead of gcc type g++. Of course the file name is cpp instead of c.
Last edited by andor; Sep 5th, 2006 at 8:40 am.
If you want to win, you must not loose (Alan Ford)
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 5,050
Reputation: John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold 
Solved Threads: 331
Moderator
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: Compile C code in Linux

 
1
  #5
Sep 5th, 2006
If you're going to get serious about programming, you may want to get an Integrated Development Enviroment, or IDE. It's a program that allows you to visually manage your source code files, which is especially useful when working with large projects that may have more than one code module. It's also easier than invoking the gcc (or g++) command each time.

Maybe this list is to complex
If so, I recommend KDevelop or Anjuta.
"Technological progress is like an axe in the hands of a pathological criminal."
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,317
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 229
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: Compile C code in Linux

 
0
  #6
Sep 5th, 2006
Originally Posted by andor View Post
No. Istead of gcc type g++. Of course the file name is cpp instead of c.
A rather odd thing to do for C code.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 275
Reputation: andor has a spectacular aura about andor has a spectacular aura about andor has a spectacular aura about 
Solved Threads: 29
andor's Avatar
andor andor is offline Offline
Posting Whiz in Training

Re: Compile C code in Linux

 
1
  #7
Sep 6th, 2006
Originally Posted by Dave Sinkula View Post
A rather odd thing to do for C code.
Yup but not for c++ code
If you want to win, you must not loose (Alan Ford)
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,317
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 229
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: Compile C code in Linux

 
2
  #8
Sep 6th, 2006
Originally Posted by andor View Post
Originally Posted by Tlhokomelo View Post
If I may ask, do I use the same process to compile cpp code?
No. Istead of gcc type g++. Of course the file name is cpp instead of c.
Originally Posted by andor View Post
Yup but not for c++ code
Ya know, I swear I read that about 5 times, but I kept missing it. D'oh!
Last edited by Dave Sinkula; Sep 6th, 2006 at 9:27 pm.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 5,050
Reputation: John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold John A is a splendid one to behold 
Solved Threads: 331
Moderator
John A's Avatar
John A John A is offline Offline
Vampirical Lurker

Re: Compile C code in Linux

 
1
  #9
Sep 6th, 2006
I think it's Automake and Autoconf that generate makefiles/configuration scripts that you can use to bundle with the program if you're planning to distribute it to ease the compilation process on other computers. Again, an IDE does all this for you.
"Technological progress is like an axe in the hands of a pathological criminal."
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC