Reputation: 111
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!
Upvotes: 5
Views: 9835
Reputation: 1
I had the same problem but I fixed it. You can simply write the following after the #include
:
using namespace std;
Upvotes: 0
Reputation: 241861
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
.)
Upvotes: 7