How to get IntelliSense to reliably work in Visual

2019-01-16 23:33发布

Does anyone know how to get IntelliSense to work reliably when working in C/C++ projects? It seems to work for about 1 in 10 files. Visual Studio 2005 seems to be a lot better than 2008.

Edit: Whilst not necessarily a solution, the work-around provided here:

How to get IntelliSense to reliably work in Visual Studio 2008

Is probably the best bet if I want a decent IntelliSense system.

12条回答
放我归山
2楼-- · 2019-01-16 23:44

I've also realized than Intellisense is sometime 'lost', on some big project. Why? No idea.

This is why we have bought Visual Assist (from Tomato software) and disabled Intellisense by deleting the dll feacp.dll in the Visual studio subdirectory (C:\Program Files\Microsoft Visual Studio 8\VC\vcpackages)

This is not a solution, just a workaround.

查看更多
Deceive 欺骗
3楼-- · 2019-01-16 23:46

I don't use VS2008 for C++, only VB & C#, but I find that when intellisense stops working (true for VS2003/2005/2008) it's because something in the project/file is broken - usually a bad reference or code.

VB and C# have much better intellisense support due to the ability to reflect on the referenced assemblies to build the intellisense tree.

C++ has to walk the include files for function prototypes, and if the paths are not correct it will not find all the prototype headers.

查看更多
唯我独甜
4楼-- · 2019-01-16 23:48

I had a very annoying problem, intellisense was working only in some files, without any evident reason... it took me a couple of hours of digging through google, but I finally understood that the reason was indeed recursive reference! I was using the:

#ifndef CLASS_H
#define CLASS_H
...
#endif

to avoid redefinition of symbols, and this sometimes breaks intellisense in big projects.

But it is enough to comment the ifndef-define-endif and put a:

#pragma once 

at the beginning of the header files to still avoid redefinitions and have Intellisense working again =)=)

At least, this worked for me, hope it's useful...

Cheers Francesco

查看更多
贪生不怕死
5楼-- · 2019-01-16 23:56

Native C++ intellisense does not work reliably in any version of Visual Studio. I find there are two common problems:

1) Header file paths are not set-up correctly. When you find a type where intellisense is not working, use the IDE to click through each header file to find the one containing the type. (Right click on #include and select Open Document...). If this fails before you get to the file which declares the type then this is your problem. Make sure header file search paths are set-up correctly.

And,

2) The intellisense database is corrupt. This happens ALL The time. You need to close the solution, delete the .ncb file, and then reopen the solution. I posted the macro I use for this in answer to another question here.


The preprocessor can also confuse intellisense - so make sure any #defines during build are also available to intellisense. Other than that, I don't know what else can break it. I've not seen any particular issues with forward declarations.

查看更多
乱世女痞
6楼-- · 2019-01-16 23:56

@John Richardson / @Jonathan Holland

My includes are setup correctly, no problems there. I've also tried the NCB rebuild several times but it never fixes it 100%.

I have a feeling it may be to do with forward declarations of classes. e.g. to reduce the complexity of includes in header files we normally do something like:

class MyPredeclared;

class SomeOtherClass
{
private:
    MyPredeclared* m_pPointer;
}

I wonder if that screws it up? Any other ideas? It definitely gets worse the larger your project gets.

查看更多
在下西门庆
7楼-- · 2019-01-16 23:58

Do you have any add-ins installed (or uninstalled)? I find that effects my intellisense.

Besides that just making sure your Tools->Options->Text Editor->All Languages "Auto List Members" and "Parameter Information" are checked off.

查看更多
登录 后发表回答