LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-10-2003, 03:48 PM   #1
eschneid
LQ Newbie
 
Registered: May 2003
Posts: 3

Rep: Reputation: 0
Question compiling c++ on red hat linux 9


i just installed red hat linux 9. i tried compiling a simple c++ program. gcc, g++. and cc cant seem to find cout even though im including iostream.h. the error is "'cout' undeclared".
is there a package i need to get? tha.

Last edited by eschneid; 05-10-2003 at 04:49 PM.
 
Old 05-10-2003, 05:01 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
try iostream, iostream.h is deprecated.

Cheers,
Tink
 
Old 05-10-2003, 05:11 PM   #3
eschneid
LQ Newbie
 
Registered: May 2003
Posts: 3

Original Poster
Rep: Reputation: 0
i have tried both.
 
Old 05-10-2003, 06:46 PM   #4
nakkaya
LQ Guru
 
Registered: Jan 2003
Location: Turkey&USA
Distribution: Emacs and linux is its device driver(Slackware,redhat)
Posts: 1,398

Rep: Reputation: 45
tyr this
#include <iostream>
using namespace std;
 
Old 05-11-2003, 07:30 AM   #5
eschneid
LQ Newbie
 
Registered: May 2003
Posts: 3

Original Poster
Rep: Reputation: 0
that worked. thanks. whats the deal? is this a new standard or something?
 
Old 05-11-2003, 12:45 PM   #6
verbal
Member
 
Registered: Jul 2002
Location: New York
Distribution: Red Hat 7.2, SuSE 7.3
Posts: 60

Rep: Reputation: 15
Quote:
that worked. thanks. whats the deal? is this a new standard or something?
This was standardized back in 2000, though established long before that. When you use iostream.h, you are essentially writting "C" and compiling it with a C++ compiler.

also:

using namespace std; // VERY bad thing, don't do this

rather, use namespace scoping:

#include <iostream>

int main( int argc, char** argv ) {

std::cout << "Hello World" << std::endl;

return( 0 );

}

----

if it really annoys you to type the extra, then at least
minimize the impact of your global declaration by:

using std::cout

---

If you are entirely unfamiliar with namespaces,
it will be worth your while to invest ten minutes
reading up on the subject, it is a very simple topic.

Verbal
 
  


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
error compiling NTFS driver for Red Hat 9 WMD Red Hat 0 07-26-2004 02:17 PM
Red Hat does not plan to release another product in the red hat linux line... Whitehat General 5 11-03-2003 07:33 PM
Compiling Kernel in Red Hat 9 quovadismaximus Linux - Newbie 2 09-29-2003 12:02 PM
Red Hat Enterprise vs. Red Hat Linux Project RedHatMN Linux - Distributions 2 07-29-2003 05:16 AM
compiling red hat 8.0 kernel? menahem Linux - Software 1 03-22-2003 10:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:00 PM.

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