5

I'm not new to programming but I am new to C++ using Xcode as the IDE. I am not allowed to use cout << "hello"; to print, the compiler complains and only works when I use std:cout <<. What setting in Xcode should be fixed in order to get this working the way I'm supposed to write it for class? Thanks!

FoxMcWeezer
  • 113
  • 1
  • 7

2 Answers2

7

Add using std::cout; somewhere close to the start of your program, after the includes.

Please avoid the temptation to use using namespace std;. It's really a bad habit. Just because you see other people doing it, doesn't make it right. See the FAQ: Why is "using namespace std" considered bad practice?

(Or, of course, you could just get use to typing std::cout.)

Community
  • 1
  • 1
rici
  • 234,347
  • 28
  • 237
  • 341
0

I had the same problem but I fixed it. You can simply write the following after the #include:

using namespace std;
double-beep
  • 5,031
  • 17
  • 33
  • 41