I’m begginer in C++ using Xcode.
I get error using Xcode C++ when trying to use declared global variable.
Here is example code.
#include <iostream>
using namespace std;
int count ;
int main()
{
count=1; // reference to 'count' is ambiguous
cout << count; // reference to 'count' is ambiguous
return 0;
}
Thank you.
There is an STL algorithm named
std::count()and as there is ausing namespace std;directive the compiler now has two availablecountsymbols to choose from: remove theusing namespace std;and usestd::cout.See Using std Namespace for further reading.