LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 02-10-2010, 09:03 PM   #1
j360
Member
 
Registered: Jan 2010
Location: Maryland
Distribution: Ubuntu
Posts: 58

Rep: Reputation: 0
GCC compiler


Hi, im new in linux and want to learn to build C programs using the GCC compiler. I installed the gnu packages already but, sorry for the ignorance but i don't know how to start the gcc compiler, someone help.
 
Old 02-10-2010, 09:08 PM   #2
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714
To compile and run a single src file:

Code:
$ ls
src.c
$ gcc src.c -o executable
$ ./executable
To compile and run multiple src files:

Code:
$ ls
src1.c
src2.h
src2.c
$ gcc src1.c src2.c -o executable
$ ./executable
 
Old 02-10-2010, 10:03 PM   #3
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by MTK358 View Post
To compile and run a single src file:

Code:
$ ls
src.c
$ gcc src.c -o executable
$ ./executable
To compile and run multiple src files:

Code:
$ ls
src1.c
src2.h
src2.c
$ gcc src1.c src2.c -o executable
$ ./executable
Rather,

Code:
gcc -Wall -Wextra src.c -o executable
Code:
gcc -Wall -Wextra src1.c src2.c -o executable

- more errors can be caught earlier in such a manner.
 
Old 02-10-2010, 10:37 PM   #4
John VV
Guru
 
Registered: Aug 2005
Posts: 13,485

Rep: Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803Reputation: 1803
j360

by chance have you even Google'ed this ???
there are 100's of tutorials on this
you might want to start here
http://www.howtoforge.com/
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
C compiler gcc hemi_426 Slackware 19 05-07-2008 01:09 PM
GCC Compiler..... mani_iips Linux - Newbie 4 08-08-2005 09:55 PM
gcc compiler canyon289 Linux - Software 3 10-23-2004 11:22 PM
GCC Compiler HELP Otaking Linux - Newbie 5 04-08-2004 07:17 PM
GCC compiler? Forezt Linux - Newbie 2 11-23-2003 03:07 PM


All times are GMT -5. The time now is 07:15 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration