Troubleshooting IntelliSense in C++ Projects
Updated: July 2010
IntelliSense can stop working under certain conditions. Use the following steps to help determine why IntelliSense does not work for C++ projects.
To investigate IntelliSense failure in C++ projects
Make sure that the Visual C++ project contains no compilation errors.
If the project is a Makefile project, see How to: Enable IntelliSense for Makefile Projects.
Make sure that stdafx.h is on the include path. For more information about include paths in Visual C++ projects, see #include Directive (C/C++) and /I (Additional Include Directories).
IntelliSense does not work in C++ projects under the following circumstances:
-
The cursor is in a code comment.
-
You are writing a string literal.
-
A syntax error appears over the cursor.
-
The solution consists of either the syntax for managed C++, or the earlier Managed Extensions for C++ syntax.
-
IntelliSense is not fully supported when you reference a header file multiple times by using the #include directive, and the meaning of that header file changes because of various macro states that are defined through the #define directive. In other words, when you include a header file several times and the header usage changes under different macro states, IntelliSense does not always work.
If you are writting a CLR wrapper class of a CPP class you can restore intellisense by wrapping the ref class in an #ifdef with an undefined and then disable clr in the build. This sure makes writing the CPP code easier. Defining the variable and enabling clr breaks it again.
One does wonder why Microsoft goes out of its way to break intellisense on pure cpp classes...
- 5/22/2012
- Grin