error C2653: ‘std’ : is not a class or namespace name

Apr 28th, 2010 by huubby in C and CPP

Today, when I created a Win32 Console Application in VS2005, and wrote the code as follow:

#include “stdafx.h”

int _tmain(int argc, _TCHAR* argv[])
{
std::string    str = “”;
str += “helllo”;
str += “world”;

printf(“%s”, str);
return 0;
}

I got compile errors:

error C2653: ‘std’ : is not a class or namespace name

At the beginning, I thought it caused by a static library on which my new project depended. Then, I removed the static library dependent, but it didn’t work.

As you know, googling is a final solution when you find something you cann’t solve. I google it and figure it out. It’s simple, as MS has a bug in this situation.

You can find why this happend here, a relational situation about the issue is here.

Over!


related post

No Comments