Visual Studio 2008类视图缺少类 [英] Visual Studio 2008 class view missing classes
问题描述
我刚刚移植了一个从较旧版本的Visual C ++到VS2008的大型项目,并注意到类视图正在聚合我的一些类。看看解决方案视图,声明这些类的头文件存在,所以我期望在类视图中看到它们。任何理由为什么某些类会被排除,或者是否有任何方法来刷新类视图来包含解决方案中的所有类。
I've just ported a large project from an older version of Visual C++ to VS2008 and notice that the class view is mising a bunch of my classes. Looking at the solution view, the header files declaring those classes are present, so I'd expect to see them in class view. Any reason why certain classes would be excluded, or is there any way to refresh class view to include all the classes in the solution ?
推荐答案
p>尝试Hans建议查看缺少类的头文件的不同之处,并注意到以下
Tried Hans' suggestion of looking what was different about a header file with a missing class, and noticed the following
myheader.h / p>
myheader.h
#ifndef MYHEADER_INCLUDED
#define MYHEADER_INCLUDED
class MyClass
{
'
'
};
#endif
现在,#ifdef之后的所有内容编辑器,它建议IDE通过宏已经定义。源还在头文件中包含相当数量的条件包含,例如
Now everything after the #ifdef was greyed out in the editor, which suggested the IDE throught the macro was already defined. The source also contains a fair amount of conditional inclusion in the header files, e.g.
#ifndef MYHEADER_INCLUDED
#include "myheader.h"
#endif
将标题更改为
myheader.h
#pragma once
class MyClass
{
'
'
};
似乎解决了类查看问题,虽然我不知道如何影响编译时间。
seems to resolve the class view problem, though I don't know how it will effect compilation times.
编辑刚完成并重新编译,编译时间没有重大变化。
Edit Just finished and did a rebuild, no significant change to compilation time.
这篇关于Visual Studio 2008类视图缺少类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!