| Wikiemol (2) | |
|
I am just beginning to learn C++ and I am on a mac. I am wondering why I have to put std:: in front of cout to trace something. (Please dont say anything like "you need to get a windows", or "use parallels", I need to learn it in Xcode) any ideas? | |
|
|
|
| Doss Buckalew (1) | |
Research namespaces in C++. To solve this particular problem, put this line of code after your #includes:using namespace std;Hope this helps. | |
|
|
|
| Albatross (3551) | |
I wouldn't call this a problem as much as a useful feature. What happens if you want to create a class named "vector" and someone decides to use your class with the "vector" defined in <vector>? Since the latter is in the std:: namespace, it prevents a naming conflict (unless you put using namespace std; somewhere relevant in your code).I hope that's understandable. -Albatross | |
|
Last edited on
|
|