LinuxQuestions.org
Help answer threads with 0 replies.
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 06-24-2009, 12:39 AM   #1
umesh_linuxq
LQ Newbie
 
Registered: Jun 2009
Posts: 8

Rep: Reputation: 0
c++ compiler for linux


Hi

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

thanks
Umesh.K
 
Old 06-24-2009, 12:45 AM   #2
Nylex
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 12:46 AM.
 
Old 06-24-2009, 05:24 AM   #3
austinium
Member
 
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
http://www.cplusplus.com/doc/tutorial/

good luck
 
  


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:53 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