scaryfast Posted August 1, 2005 Share Posted August 1, 2005 (edited) Hi. When I try compiling the following source using g++: #include <iostream> int main() { cout << "Hello, World\n"; return -1; } I get: hello.cc: In function `int main()': hello.cc:4: error: `cout' undeclared (first use this function) hello.cc:4: error: (Each undeclared identifier is reported only once for each function it appears in.) Can anyone help me fix this? Edited August 1, 2005 by scaryfast Link to comment Share on other sites More sharing options...
scaryfast Posted August 1, 2005 Author Share Posted August 1, 2005 I've just figured this out - #include <iostream> using namespace std; int main() { cout << "Hello World From About\n"; } I needed the 'namespace'. How embarrasing. Sorry. Link to comment Share on other sites More sharing options...
steppenwolf1984 Posted August 18, 2005 Share Posted August 18, 2005 Dont feel so bad, that undeclared cout keep me going for weeks! I was using a rather useful tutorial.....when in doubt, learn python i always say.... :P Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now