Visual Studio 2008 class view missing classes

落爺英雄遲暮 提交于 2019-12-11 03:45:43

问题


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 ?


回答1:


Have you tried deleting the .ncb and the .pch, and all the .o files, then a full rebuild? I find that this often fixes my intellisense problems, and it may be related.




回答2:


Tried Hans' suggestion of looking what was different about a header file with a missing class, and noticed the following

myheader.h

#ifndef MYHEADER_INCLUDED
#define MYHEADER_INCLUDED

class MyClass 
{ 
'
'
};

#endif

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

Changing the header to

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.



来源:https://stackoverflow.com/questions/4873971/visual-studio-2008-class-view-missing-classes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!