I did try using int main( ) before I posted the question. This is the error I am getting along with the complete program:
Code:
#include <iostream>
using namespace std;
unsigned count = 0;
class C
{
public:
C ( ) {cout << "Creating C" << ++count '\n'; }
};
int main() {
C ar[ 1000 ];
return 0;
}
"127.cpp" 25 lines, 184 characters
admiral% g++ 127.cpp
127.cpp: In constructor `C::C()':
127.cpp:14: error: use of `count' is ambiguous
127.cpp:9: error: first declared as `unsigned int count' here
/usr/local/gcc3/bin/../lib/gcc/sparc-sun-solaris2.8/3.4.5/../../../../include/c++/3.4.5/bits/stl_algo.h:413: error: also declared as `typename std::iterator_traits<_Iterator>::difference_type std::count(_InputIterator, _InputIterator, const _Tp&)' here
127.cpp:14: error: `count' was not declared in this scope
127.cpp:14: error: expected `;' before '\xa'