LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-25-2003, 02:25 AM   #1
vichet
LQ Newbie
 
Registered: Apr 2002
Posts: 7

Rep: Reputation: 0
how to use gcc


hello

i try to use gcc to compile some c++ programs
but whenever i type gcc at the # prompt it says
"command not found".

so how to use gcc properly?

thanks

vichet
 
Old 02-25-2003, 03:20 AM   #2
finidi
Member
 
Registered: Dec 2002
Location: World
Distribution: Fedora Core 4
Posts: 127

Rep: Reputation: 15
Is it installed ??
 
Old 02-25-2003, 08:10 AM   #3
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
Type:

which gcc

If it says something like "no gcc found in ....." then it's either not installed, or is not in your path anywhere. You may need to install it.

By the way, gcc is a C compiler. Do not use it to compile C++ programs, since it won't usually work. Use g++ to compile C++ programs.
 
Old 03-22-2003, 12:13 PM   #4
tsitras
Member
 
Registered: Mar 2003
Distribution: Debian Squeeze
Posts: 182

Rep: Reputation: 30
For example the name of the file that you want to compile is paper.cpp, then all you have to do is go to the terminal and access the folder where the file paper.cpp is sitting. then type gcc paper.cpp -o paper
 
Old 03-22-2003, 03:53 PM   #5
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
Quote:
Originally posted by tsitras
For example the name of the file that you want to compile is paper.cpp, then all you have to do is go to the terminal and access the folder where the file paper.cpp is sitting. then type gcc paper.cpp -o paper
Though, if you read the post, vichet said that typing 'gcc' does not work And again: gcc is a C compiler, g++ is a C++ compiler. Usually anything with a .cpp extension is C++.
 
Old 03-22-2003, 04:33 PM   #6
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,568

Rep: Reputation: 164Reputation: 164
Distros like Mandrake and RedHat don't install compiler by default, so I guess you don't have it. Insert your first installation cd to the cd drive, mount it, open package manager for your distro and install all the packages beginning with 'gcc' and 'g++'.
 
  


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
gcc wont install, 'failed dependencies: glibc-devel is needed by gcc-3.3.3-41' TdlSnare SUSE / openSUSE 3 11-29-2004 03:13 PM
Kernel compiling: gcc-3.3 is 586, should be gcc-3.3 386 Erik Plaggenmar Linux - Software 0 10-01-2004 12:38 PM
running software built with gcc 3.0.2 on Redhat 8 - gcc 3.2 dst1989 Linux - Software 3 03-08-2004 11:23 PM
a doubt with host gcc and arm-linux-gcc renjithgopal Linux - General 1 09-11-2003 05:02 PM
export CC=/usr/bin/gcc-3.2 - switch gcc version? ferreter Linux - Software 1 08-20-2003 01:07 AM


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