C++ 错误 C2065:未声明的标识符
c++ error C2065: undeclared identifier
>----EDIT找到解决方案,类的命名空间错误。这篇文章可以作为一个例子
我得到这个错误,所以我对我到底做错了什么感到困惑。在某些方面.cpp我声明:
。.cpp:
#include "header1.hpp"
#include "header2.h"
using namespace wre;
namespace awq
{
//somethings
void function()
{
std::vector<classW>::iterator it1; //I mean class upr::classW
std::map<int, classQ> map1; //I mean class pwe::classQ
//iterations which don't work
}
}
标题1.hpp
namespace upr
{
class classW
{
//things
}
}
标头2.h
namespace wre
{
class classQ
{
//things
}
}
为什么它看不到这个类W?因此,它1的大小未知...所以两个愚蠢的错误。
类Q - 没有问题。
这里有什么意义,有人知道吗?(我在各种命名空间上运行,如有必要,我可以将其添加到这篇文章中)
我想你在做什么是:
标头1.h
namespace N{
class classW{ };
}
标头2.h
namespace M{
class classQ{ };
}
一些.cpp
#include "header1.h"
#include "header2.h
std::vector<classW>::iterator it1;
std::map<int, classQ> map1;
从这里,你会得到未定义的classW/classQ错误,因为编译器无法从全局命名空间中找到classW/classQ。
您可以实现一些.cpp例如:
#include "header1.h"
#include "header2.h
std::vector<N::classW> v1;
std::vector<N::classW>::iterator it1;
std::map<int, M::classQ> map1;
但这都是我的猜测,需要查看更多代码才能看到代码中真正发生的事情。
相关文章:
- #ifdef和未声明的标识符
- 未声明的标识符编译暗黑破坏神 2 程序"muleview"
- 在顶点着色器中使用 OpenGl 的未声明标识符,我在顶点着色器中绘制三角形时遇到问题
- Google protobuf 时间戳未声明标识符,在 Windows 上具有C++
- 使用未声明的标识符"sqrt"?
- 对类 (C++) 中的私有变量使用未声明的标识符
- 我的代码中有错误,未声明的标识符
- 未定义的标识符/未声明
- 错误:在 C++ 'std'使用未声明的标识符
- 在编译器之前检测未声明的标识符
- 使用未声明的标识符'temp'
- 使用未声明的标识符"yylex"和"yyin"?
- 使用"class"关键字,后跟未声明的标识符
- 未声明的标识符错误,但变量定义正确 (?)
- C2065 'cout':未声明的标识符
- C++模板模板参数中未声明的标识符
- 错误:在 C++ 目标 c 混合'self'使用未声明的标识符
- C++循环依赖关系,未声明的标识符
- 我的函数调用 (C++) 中的未声明标识符
- 未找到标识符和未声明的标识符