I am very very beginner. I am just starting learning C++ and i friend recommended this compiler
Few minutes later i already have problems :P
// asdf
include <iostream>
main ()
{
cout <<"Hello world!";
return 0;
}
That's the program...cant be simpler and i still get an error:
C:\Documents and Settings\Vendo\Desktop\cpp\main.cpp In function int main()':
91 C:\Documents and Settings\Vendo\Desktop\cpp\main.cppcout' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Short answer - check out the thread titled 'Please Read Before Posting a Question' - there is an example Hello World there.
Longer version - C++ uses something called namespaces to keep things straight in a language that encourages using names multiple times. You did not tell the compiler what namespace to find cout etc. in.
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am very very beginner. I am just starting learning C++ and i friend recommended this compiler
Few minutes later i already have problems :P
// asdf
include <iostream>
main ()
{
cout <<"Hello world!";
return 0;
}
That's the program...cant be simpler and i still get an error:
C:\Documents and Settings\Vendo\Desktop\cpp\main.cpp In function
int main()': 91 C:\Documents and Settings\Vendo\Desktop\cpp\main.cpp
cout' undeclared (first use this function)(Each undeclared identifier is reported only once for each function it appears in.)
Short answer - check out the thread titled 'Please Read Before Posting a Question' - there is an example Hello World there.
Longer version - C++ uses something called namespaces to keep things straight in a language that encourages using names multiple times. You did not tell the compiler what namespace to find cout etc. in.
Wayne
It is also a very bad idea to put your code in places with spaces in their path, like your desktop.
I encourage you to take the time to read through the "Please Read" thread, it covers a lot of
useful material.
Wayne
You have to put ,std::cout , or, using namespace std;,I am also beginer
Answer : The only bug in your program is that you didn't specify the namespace to be used.
Here is the correct version :
// asdf
include <iostream>
using namespace std;
main ()
{
cout <<"Hello world!";
return 0;
}
What about the implicit return type for main() !? That looks like a bug too to me.
Why would you see the need I wonder to answer a question that was already adequately answered with a flawed response, twe weeks after it was relevant?
Clifford