943,617 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 14889
  • C++ RSS
Sep 4th, 2006
0

Compile C code in Linux

Expand Post »
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.
Similar Threads
Reputation Points: 16
Solved Threads: 1
Newbie Poster
Tlhokomelo is offline Offline
19 posts
since Oct 2004
Sep 4th, 2006
1

Re: Compile C code in Linux

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.
Reputation Points: 251
Solved Threads: 29
Posting Whiz in Training
andor is offline Offline
274 posts
since Jun 2005
Sep 5th, 2006
1

Re: Compile C code in Linux

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
Reputation Points: 16
Solved Threads: 1
Newbie Poster
Tlhokomelo is offline Offline
19 posts
since Oct 2004
Sep 5th, 2006
1

Re: Compile C code in Linux

Click to Expand / Collapse  Quote originally posted by Tlhokomelo ...
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.
Reputation Points: 251
Solved Threads: 29
Posting Whiz in Training
andor is offline Offline
274 posts
since Jun 2005
Sep 5th, 2006
1

Re: Compile C code in Linux

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.
Team Colleague
Reputation Points: 2240
Solved Threads: 338
Vampirical Lurker
John A is offline Offline
5,055 posts
since Apr 2006
Sep 5th, 2006
0

Re: Compile C code in Linux

Click to Expand / Collapse  Quote originally posted by andor ...
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.
Team Colleague
Reputation Points: 2780
Solved Threads: 312
long time no c
Dave Sinkula is offline Offline
4,790 posts
since Apr 2004
Sep 6th, 2006
1

Re: Compile C code in Linux

A rather odd thing to do for C code.
Yup but not for c++ code
Reputation Points: 251
Solved Threads: 29
Posting Whiz in Training
andor is offline Offline
274 posts
since Jun 2005
Sep 6th, 2006
2

Re: Compile C code in Linux

Click to Expand / Collapse  Quote originally posted by andor ...
Click to Expand / Collapse  Quote originally posted by Tlhokomelo ...
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.
Click to Expand / Collapse  Quote originally posted by andor ...
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.
Team Colleague
Reputation Points: 2780
Solved Threads: 312
long time no c
Dave Sinkula is offline Offline
4,790 posts
since Apr 2004
Sep 6th, 2006
1

Re: Compile C code in Linux

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.
Team Colleague
Reputation Points: 2240
Solved Threads: 338
Vampirical Lurker
John A is offline Offline
5,055 posts
since Apr 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: string to double
Next Thread in C++ Forum Timeline: Get MAC ADDRESS from VC++ or c language





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC