delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/24/03:31:27

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: cout error
Date: Thu, 23 Apr 1998 23:29:45 -0400
Organization: Two pounds of chaos and a pinch of salt.
Lines: 41
Message-ID: <35400729.6CAF@cs.com>
References: <6hmete$ni7$1 AT nnrp1 DOT dejanews DOT com>
NNTP-Posting-Host: ppp241.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

king1 AT dwave DOT net wrote:
> 
> When i try to compile the hello.cpp program I get this error:
> c:\DJGPP>gxx hello.cpp -o hello.exe
> hello.cpp: In function 'int main(...)':
> hello.cpp:4: 'cout' undeclared (first use this function)
> hello.cpp:4: (Each undeclared identifier is reported only once
> hello.cpp:4: For each function it appears in.)

Try adding #include <iostream.h> to your program.

> so I tried to compile
>  void main(void)

Please don't do this.  void is not a valid return type for main(); it
must return an integer.

>  {
>  }
> i get:
> c:\DJGPP>gxx h.cpp -o h.exe
> c:\/djgpp/bin\ld.exe: cannot open -lgpp: No such file or directory (ENOENT)

This means one of two things:  you did not download the C++ libraries
(v2gnu/lgp271b.zip), or you did not set the DJGPP environment variable
correctly.  Please read the instructions in 'readme.1st' again.

> could some one please help me.  I have very little experience with c++ and
> have just gotten the program. TNX Josh King1 AT dwave DOT net

I seriously recommend that you read a C++ tutorial or take a course;
it's not easy to pick up on your own without some prior programming
experience.

-- 
---------------------------------------------------------------------
|      John M. Aldrich       | "A generation which ignores history  |
|       aka Fighteer I       | has no past--and no future."         |
|   mailto:fighteer AT cs DOT com   |                                      |
| http://www.cs.com/fighteer |                - Lazarus Long        |
---------------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019