Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 06-24-2009, 01:39 AM   #1
LQ Newbie
Registered: Jun 2009
Posts: 8

Rep: Reputation: 0
c++ compiler for linux


This question is relating to C++ compiler on linux. I want to run C++ program in linux. When i save the program as 'hello.cpp' and run using "gcc compiler" , a message pops-up telling that 'iostream.h' is not found and hence 'cout' & 'cin' is an undeclared identifier.
When i modify the program to include 'iostream' instead of 'iostream.h', it gives the error message as -> 'cout' was not declared in this scope. I have just started C++ programming in Linux. Please suggest me whether i need to install anything to compile and run C++ programs

Old 06-24-2009, 01:45 AM   #2
LQ Addict
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
You use g++ to compile C++ code, e.g. "g++ hello.cpp -o hello". If you get a "command not found" error, then you'll need to install the g++ package for your distro (and possibly others, too). If this is the case, please tell us which distro you're using.

Also, you do have the line "using namespace std;" under your "#include <iostream>", right? If not, you need to add it, or use "std::cout" rather than just "cout" (the same goes for cin).

Last edited by Nylex; 06-24-2009 at 01:46 AM.
Old 06-24-2009, 06:24 AM   #3
Registered: Nov 2007
Location: India
Distribution: Debian Stable, Debian Testing
Posts: 218

Rep: Reputation: 27
hi umesh,

.h headers like iostream.h are deprecated, g++ works with the newer standard spec. C++.

Search for some tutorial online, the one below maybe of help

good luck


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
checking for C compiler default output... configure: error: C compiler cannot create fiorejm Linux - Software 6 11-12-2009 01:35 PM
So I need a C compiler to install a c compiler. Makes sense. vic305 Linux - Software 8 12-17-2008 11:30 PM
My c compiler doesn't work after the cross-compiler installed Linux - Newbie 1 06-05-2007 04:55 AM
Compiler conundrum: Which came first, a compiler, or it's source code? fr0zen Programming 21 01-29-2004 05:31 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:14 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration