C++ 错误c2871:“std”具有此名称的命名空间不存在
在我的项目中,我禁用了预编译的标题。 下面是代码示例C++ 错误c2871:“std”具有此名称的命名空间不存在,c++,visual-studio-2008,C++,Visual Studio 2008,在我的项目中,我禁用了预编译的标题。 下面是代码示例 #include <stdio.h> #include <conio.h> #include "Getfilelist.h" using namespace std; int main() { Getfilelist fl; int i = fl.GetFList("J:\\EDUCATION\\Mine\\seminar\\seminar-1"); getch(); return 0;
#include <stdio.h>
#include <conio.h>
#include "Getfilelist.h"
using namespace std;
int main()
{
Getfilelist fl;
int i = fl.GetFList("J:\\EDUCATION\\Mine\\seminar\\seminar-1");
getch();
return 0;
}
您应该改为包含。当您只包含C头时,为什么希望定义名称空间std?我只想知道这个错误的原因。我已经做了很多项目,包括标题和名称空间std,但这是我第一次遇到这个错误。谢谢你的解决方案。但我从一年前就开始使用VS2008了,以前从未遇到过名称空间“std”的问题。我可以知道此错误的原因吗?stdio.h可能无法在命名空间std中包装函数以实现向后兼容性。@user3615925您始终包括(可能是间接地)至少一个引入std命名空间的标头。
error c2871: 'std' a namespace with this name does not exist