| delorie.com/archives/browse.cgi | search |
| From: | "Jesper Lund" <jl1204 AT worldonline DOT dk> |
| Newsgroups: | comp.os.msdos.djgpp |
| References: | <20020813142638 DOT 26420 DOT 00000048 AT mb-bd DOT aol DOT com> |
| Subject: | Re: newbie help |
| Lines: | 27 |
| X-Priority: | 3 |
| X-MSMail-Priority: | Normal |
| X-Newsreader: | Microsoft Outlook Express 5.50.4807.1700 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.4807.1700 |
| Message-ID: | <oYe69.358$ww6.104411@news010.worldonline.dk> |
| Date: | Tue, 13 Aug 2002 23:35:10 +0200 |
| NNTP-Posting-Host: | 213.237.1.107 |
| X-Complaints-To: | news-abuse AT wol DOT dk |
| X-Trace: | news010.worldonline.dk 1029274516 213.237.1.107 (Tue, 13 Aug 2002 23:35:16 MET DST) |
| NNTP-Posting-Date: | Tue, 13 Aug 2002 23:35:16 MET DST |
| Organization: | Customer of Tiscali A/S |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
"Steveadele" <steveadele AT aol DOT com> wrote:
> #include <iostream.h>
>
> int main()
> {
> cout << "hello world!\n";
> return 0;
> }
> that is exactly how the book shows it also but,
> when i compile it i get a list of errors;
> hello.cpp: inf function 'int main()':
> hello.cpp:6: count undeclared (first use this function)
> hello.cpp:6: (each undeclared identifier is reported only once
> hello.cpp:6: for each function it appears in.)
> hello.cpp:6: parse error before ';'
> can anyone tell me what im doing wrong?
1) Use #include <iostream> instead of <iostream.h>
2) Are you sure that you didn't misspell 'cout' as 'count' ?
3) If you are using gcc 3.x (check with gcc -v), your code must take into
account that cout is in the std namespace (as the C++ standard says). Write
std::cout or put a line with 'using namespace std;' after the #include
statement.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |