A program main.cc:
It works well. But when I replaceCode:#include <iostream> #include <string> namespace Test{ #define STAR "*" } int main(){ std::string str = "this is a test"; std::string star = "*"; //std::string star = Test::STAR; std::cout<<str<<star<<std::endl; return 0; }
withCode:std::string star = "*";
it reports wierd errors like:Code:std::string star = Test::STAR;
main.cc:13: error: `std' undeclared (first use this function)
I suspect it is a problem of namespace. Anybody has a clue?