Troubleshooting "cout was not declared in scope" with XCode

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 5K views
00PS
Messages
30
Reaction score
0
std:: was not used in my previous experiences with programming in C/C++ but in xcode,it requires you to put 'std::' in front of both count and cin. i get an error that reads 'count' was not declared in scope. I am sure it is something very trivial but in insights would be appreciated.
 
Physics news on Phys.org
C++ has the concept of "namespaces". In standard C++, all functions and global variables must be declared within some namespace. I hope you'll forgive me for not taking the time to write a long tutorial on namespaces when there is a lot of material about namespaces available already, for example with a Google search on "C++ namespaces".

After doing some reading, if you have specific questions, please feel free to ask here!
 
thanks for the help!

namespace was not a concept i remember from my programming classes so it was nice to learn something new. :)