Page 1 of 1
Need Help
Posted: Sun Apr 05, 2009 8:47 pm
by RandomDever
Okay here's the whole program I wrote.
Code: Select all
#include <iostream>
void main()
{
cout << "WTF?????";
}
I'm using Microsoft Visual C++ 2008
Here's the error:
main.cpp(5) : error C2065: 'cout' : undeclared identifier
What did I do wrong?????
Re: Need Help
Posted: Sun Apr 05, 2009 9:07 pm
by Ginto8
you may want to make
into
and add a
at the end of it.
As for the problem with cout... I have no idea.
Re: Need Help
Posted: Sun Apr 05, 2009 9:15 pm
by Maevik
cout ( as well as cin , endl etc... ) is part of the namespace "std"
Therefore, in order to use it you must either use the namespace:
or use the identifier std::cout;
It should work as:
Code: Select all
#include <iostream>
using namespace std;
void main()
{
cout << "WTF?????";
}
or:
Code: Select all
#include <iostream>
void main()
{
std::cout << "WTF?????";
}
Re: Need Help
Posted: Sun Apr 05, 2009 9:18 pm
by RandomDever
Sorry Maevik..
I'm fucking retarded.
I forgot I'm not using codeblocks any more.
Re: Need Help
Posted: Sun Apr 05, 2009 9:21 pm
by Maevik
heh, I just like when someone has an easy question that I may actually know the answer to :D