A weird problem of namespace
A program main.cc:
Code:
#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;
}
It works well. But when I replace
Code:
std::string star = "*";
with
Code:
std::string star = Test::STAR;
it reports wierd errors like:
main.cc:13: error: `std' undeclared (first use this function)
I suspect it is a problem of namespace. Anybody has a clue?