How to get IntelliSense to reliably work in Visual Studio 2008

后端 未结 12 1573
暗喜
暗喜 2020-12-08 04:13

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 bett

相关标签:
12条回答
  • 2020-12-08 04:53

    My fix to itellisense was required after that awful refactor utility minced my code. The problem was a class header file that included an #include of itself. The recursive reference destroys itellisense. A symptom of this is if itellisense can see other classes but not the current one. Also:

    Use #pragma once to eliminate duplicate header loads

    If the project now takes a very much longer time to load, that itellisense trying to make sense of the conflict that is causing then lack of completion support.

    Often it is only one class object that is affected, This shows you what files (usually headers) to look at.

    0 讨论(0)
  • 2020-12-08 04:57

    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.

    0 讨论(0)
  • 2020-12-08 04:57

    The problem is with the .vcproj files.

    You will find if you switch to release mode from debug mode, build, then try intellisense it often works.

    Close Visual Studio. If you search for the .vcproj files in your project, edit them and search for the first two instances of AdditionalIncludeDirectories. The value for this should look something like "..\,....\" rather than "../..".

    Reopen your project, let the Intellisense finish building, then it should be fixed.

    0 讨论(0)
  • 2020-12-08 05:00

    I had to reset the settings...

    C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE>devenv.exe /ResetSettings

    thread on this here

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2020-12-08 05:01

    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

    0 讨论(0)
提交回复
热议问题