Visual Studio 2012 Professional 无法识别类 - 有时
Visual Studio 2012 Professional doesn't recognize a class - sometimes
据我所知,我的代码没有实际问题,但Visual Studio无法识别*.h文件中的特定类。它识别前面的结构和后面的类,如果我放入一个额外的
class test {
int foo;
public:
void bar();
}
就在之前,它找到了它(但现在它找不到test
。)
澄清一下:通过识别,我谈论的是两件事:代码窗口顶部的作用域栏和扩展FooBar.h的列表。前者坚持类中的空间仍然是"全局作用域",后者列出了我所有的函数,就好像它们是全局函数一样。
这种情况在重分析中仍然存在——如上所述,我可以通过添加类test
来解决问题,并通过删除伪类来重新创建它。
IntelliSense仍然将类及其方法识别为属于该类,这显然很奇怪。。。
实际代码如下。
//This shows up fine: expanding FooBar.h reveals a sub-list called Update, with
//fields "pE, pEgivenH, E" and methods "Update(...), ~Update(), operator=," and so on.
struct Update {
public:
double pEgivenH, pE;
EvidenceID E;
Update(double, double, EvidenceID);
~Update();
Update &operator=(const Update &rhs);
int operator==(const Update &rhs) const;
int operator<(const Update &rhs) const;
}
// Point A
// This doesn't, though. When the cursor is placed within this class, the bar insists
// that it is "global scope", and all methods here show up as global methods under
// FooBar.h. The problem goes away if I add a class at Point A.
class Hypothesis {
string hypothesis;
double currentP;
double prior;
public:
list<Update> history;
~Hypothesis();
Hypothesis &operator=(const Hypothesis &rhs);
int operator==(const Hypothesis &rhs) const;
int operator<(const Hypothesis &rhs) const;
Hypothesis(string, double);
double updateHypothesis(Update);
double recalcHypothesis();
string getHypothesis();
double getProbability();
}
// This class also shows up fine.
class Action {
ActionType type;
Update ubefore, uafter;
Hypothesis hbefore, hafter;
EvidenceID ebefore;
public:
void undo();
void redo();
}
看起来每个结构/类后面都缺少分号。
相关文章:
- 提升 ASIO 无法识别计时器对象
- 从udp接收帧对于人脸识别来说太慢
- 模板类无法识别友元运算符
- std::visit无法识别类型
- 无法识别模板功能
- 我有两个类需要在同一 cpp 文件中相互引用,但第一个类无法识别第二个类类型的对象
- 如何在LLVM中dyn_cast以识别StoreInst?
- 从不同的附加依赖项中识别等同命名的函数
- C++出现控制台错误.我无法识别源代码的问题
- 为什么有时我输入一个整数,程序将第一个输入的数字打印成十进制数?
- VSCode IntelliSense无法识别SDL框架的SDL_image扩展库
- Qt:"Q3DScatter"即使包含在内也无法识别
- C++ boost::asio::ip::tcp::acceptor 有时不接受连接器?
- 使用指针的类识别
- 如何静态识别动态堆分配?
- 为什么C++无法识别我的对象实例化?
- C++ 无法识别创建进程'telnet'
- 识别 2D 矢量C++中的位置
- 为什么我的程序有时只能正确识别数组中的最高和最低值
- Visual Studio 2012 Professional 无法识别类 - 有时