Thread: [Dev-C++] Error using std::cout
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Napoleon A. <nah...@so...> - 2002-06-29 15:32:25
|
Hello,
I just tried to compile this program and I had an error saying cout not =
declared:
#include <iostream>
#include <stdlib.h>
using std::cout;
class World
{
public:
World (int i)
{
std::cout << "Hello from " << i << ".\n";
}
~World ()
{
std::cout << "Good bye.\n";
}
};
World TheWorld (1);
int main()
{
World myWorld (2);
std::cout << "Hello from main!\n";
}
I'll appreciate any help you can give me.
Napoleon.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.372 / Virus Database: 207 - Release Date: 20/06/02
|
|
From: Rob A. <ro...@us...> - 2002-06-29 15:49:48
|
I just pasted your code into a blank source file on Dev-C++ 4.9.4.0 and compiled it without problem. Here's the output: Hello from 1. Hello from 2. Hello from main! Good bye. Good bye. Rob Andrews http://uselesspython.com Napoleon Ahiable wrote: > Hello, > > I just tried to compile this program and I had an error saying cout not > declared: > -- "Giving the Linus Torvalds Award to the Free Software Foundation is a bit like giving the Han Solo Award to the Rebel Alliance." --Richard Stallman at the 1999 LinuxWorld show |
|
From: Ioannis V. <no...@ho...> - 2002-06-29 16:06:38
|
I found no errors, the code is ok. How did you try to compile it? Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net <http://www.noicys.cjb.net/> * Alternative URL: http://run.to/noicys -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Napoleon Ahiable Sent: Saturday, June 29, 2002 6:21 PM To: dev...@li... Subject: [Dev-C++] Error using std::cout Hello, I just tried to compile this program and I had an error saying cout not declared: #include <iostream> #include <stdlib.h> using std::cout; class World { public: World (int i) { std::cout << "Hello from " << i << ".\n"; } ~World () { std::cout << "Good bye.\n"; } }; World TheWorld (1); int main() { World myWorld (2); std::cout << "Hello from main!\n"; } I'll appreciate any help you can give me. Napoleon. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.372 / Virus Database: 207 - Release Date: 20/06/02 |
|
From: Napoleon A. <nah...@so...> - 2002-06-29 16:13:33
|
Hello and thanks, I don,t know what I'm doing wrong but all I've done is create a console project with the source code. and when I compile I get the following error still: /C++Lab/Temp/test.cpp C:\C++Lab\Temp\C In constructor `World::World(int)': 10 C:\C++Lab\Temp\test.cpp `cout' undeclared in namespace `std' I'm still scratching my head . Napoleon. ----- Original Message ----- From: "Rob Andrews" <ro...@us...> To: "Napoleon Ahiable" <nah...@so...> Sent: Saturday, June 29, 2002 4:48 PM Subject: Re: [Dev-C++] Error using std::cout > I just pasted your code into a blank source file on Dev-C++ 4.9.4.0 and > compiled it without problem. Here's the output: > > Hello from 1. > Hello from 2. > Hello from main! > Good bye. > Good bye. > > Rob Andrews > http://uselesspython.com > > Napoleon Ahiable wrote: > > > Hello, > > > > > > > > I just tried to compile this program and I had an error saying cout not > > declared: > > > > > > > > > > #include <iostream> > > #include <stdlib.h> > > > > > > > > using std::cout; > > > > > > > > class World > > { > > public: > > World (int i) > > { > > std::cout << "Hello from " << i << ".\n"; > > } > > > > > > > > ~World () > > { > > std::cout << "Good bye.\n"; > > } > > }; > > > > > > > > World TheWorld (1); > > > > > > > > int main() > > { > > World myWorld (2); > > std::cout << "Hello from main!\n"; > > } > > > > > > > > I'll appreciate any help you can give me. > > > > > > > > Napoleon. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.372 / Virus Database: 207 - Release Date: 20/06/02 |
|
From: Ioannis V. <no...@ho...> - 2002-06-29 16:18:47
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Napoleon Ahiable > Sent: Saturday, June 29, 2002 7:12 PM > To: dev...@li... > Subject: Re: [Dev-C++] Error using std::cout > > > Hello and thanks, > > I don,t know what I'm doing wrong but all I've done is create > a console > project with the source code. and when I compile I get the > following error > still: > > /C++Lab/Temp/test.cpp C:\C++Lab\Temp\C > In constructor `World::World(int)': > 10 C:\C++Lab\Temp\test.cpp > `cout' undeclared in namespace `std' > > I'm still scratching my head . It may be a Dev-C++ bug. Try to create a blank file without any project, save it as .cpp and compile it. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net * Alternative URL: http://run.to/noicys |
|
From: Rob A. <ro...@us...> - 2002-06-29 16:35:03
|
I just created a new console application project and pasted your code in to replace the default code. Still no problems. I received the clock skew error on the first compile, but the second compile proceeded without incident. Rob http://uselesspython.com Ioannis Vranos wrote: >>-----Original Message----- >>I don,t know what I'm doing wrong but all I've done is create >>a console >>project with the source code. and when I compile I get the >>following error >>still: >> >>/C++Lab/Temp/test.cpp C:\C++Lab\Temp\C >>In constructor `World::World(int)': >>10 C:\C++Lab\Temp\test.cpp >>`cout' undeclared in namespace `std' >> >>I'm still scratching my head . >> -- "Giving the Linus Torvalds Award to the Free Software Foundation is a bit like giving the Han Solo Award to the Rebel Alliance." --Richard Stallman at the 1999 LinuxWorld show |
|
From: Napoleon A. <nah...@so...> - 2002-06-29 18:14:08
|
Hello Fellas, Thanks for your help but I think what it's alright now. I unistalled dev-C++ and did a fresh download and installed and it seems to be fine. Thanks for your help. Napoleon. ----- Original Message ----- From: "Ioannis Vranos" <no...@ho...> To: <dev...@li...> Sent: Saturday, June 29, 2002 5:18 PM Subject: RE: [Dev-C++] Error using std::cout > > -----Original Message----- > > From: dev...@li... > > [mailto:dev...@li...] On Behalf > > Of Napoleon Ahiable > > Sent: Saturday, June 29, 2002 7:12 PM > > To: dev...@li... > > Subject: Re: [Dev-C++] Error using std::cout > > > > > > Hello and thanks, > > > > I don,t know what I'm doing wrong but all I've done is create > > a console > > project with the source code. and when I compile I get the > > following error > > still: > > > > /C++Lab/Temp/test.cpp C:\C++Lab\Temp\C > > In constructor `World::World(int)': > > 10 C:\C++Lab\Temp\test.cpp > > `cout' undeclared in namespace `std' > > > > I'm still scratching my head . > > > It may be a Dev-C++ bug. Try to create a blank file without any project, > save it as .cpp and compile it. > > > > Ioannis > > * Ioannis Vranos > * Programming pages: http://www.noicys.cjb.net > * Alternative URL: http://run.to/noicys --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.372 / Virus Database: 207 - Release Date: 20/06/02 |