<p>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.</p>

<p>Edit: Whilst not necessarily a solution, the work-around provided here: </p>

<p><a href="https://stackoverflow.com/questions/39474/how-to-get-intellisense-to-reliably-work-in-visual-studio-2008#39590">How to get IntelliSense to reliably work in Visual Studio 2008</a></p>

<p>Is probably the best bet if I want a decent IntelliSense system.</p>

[{'answer_id': 39518, 'author': 'John Richardson', 'author_id': 887, 'author_profile': 'https://Stackoverflow.com/users/887', 'pm_score': 5, 'selected': False, 'text': '<p>Native C++ intellisense does not work reliably in any version of Visual Studio. I find there are two common problems: </p>\n\n<p>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.</p>\n\n<p>And,</p>\n\n<p>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 <a href="https://stackoverflow.com/questions/15056/do-you-have-any-recommended-macros-for-microsoft-visual-studio#32884">here</a>.</p>\n\n<hr>\n\n<p>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.</p>\n'}, {'answer_id': 39526, 'author': 'FlySwat', 'author_id': 1965, 'author_profile': 'https://Stackoverflow.com/users/1965', 'pm_score': 2, 'selected': False, 'text': "<blockquote>\n  <p>I don't use VS2008 for C++, only VB &amp; 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.</p>\n</blockquote>\n\n<p>VB and C# have much better intellisense support due to the ability to reflect on the referenced assemblies to build the intellisense tree.</p>\n\n<p>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.</p>\n"}, {'answer_id': 39534, 'author': 'Mark Ingram', 'author_id': 986, 'author_profile': 'https://Stackoverflow.com/users/986', 'pm_score': 1, 'selected': False, 'text': '<p>@<a href="https://stackoverflow.com/questions/39474/how-to-get-intellisense-to-reliably-work-in-visual-studio-2008#39518">John Richardson</a> / @<a href="https://stackoverflow.com/questions/39474/how-to-get-intellisense-to-reliably-work-in-visual-studio-2008#39526">Jonathan Holland</a></p>\n\n<p>My includes are setup correctly, no problems there. I\'ve also tried the NCB rebuild several times but it never fixes it 100%.</p>\n\n<p>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:</p>\n\n<pre><code>class MyPredeclared;\n\nclass SomeOtherClass\n{\nprivate:\n    MyPredeclared* m_pPointer;\n}\n</code></pre>\n\n<p>I wonder if that screws it up? Any other ideas? It definitely gets worse the larger your project gets.</p>\n'}, {'answer_id': 39589, 'author': 'Sara Chipps', 'author_id': 4140, 'author_profile': 'https://Stackoverflow.com/users/4140', 'pm_score': 2, 'selected': False, 'text': '<p>Do you have any add-ins installed (or uninstalled)? I find that effects my intellisense. </p>\n\n<p>Besides that just making sure your Tools->Options->Text Editor->All Languages "Auto List Members" and "Parameter Information" are checked off. </p>\n'}, {'answer_id': 39590, 'author': 'Steve Gury', 'author_id': 1578, 'author_profile': 'https://Stackoverflow.com/users/1578', 'pm_score': 6, 'selected': True, 'text': '<p>I\'ve also realized than Intellisense is sometime \'lost\', on some big project. Why? No idea.</p>\n\n<p>This is why we have bought <a href="http://www.wholetomato.com/" rel="noreferrer">Visual Assist</a> (from <a href="http://www.wholetomato.com/" rel="noreferrer">Tomato software</a>) and disabled Intellisense by deleting the dll feacp.dll in the Visual studio subdirectory (C:\\Program Files\\Microsoft Visual Studio 8\\VC\\vcpackages)</p>\n\n<p>This is not a solution, just a workaround.</p>\n'}, {'answer_id': 927405, 'author': 'Nick McCowin', 'author_id': 52683, 'author_profile': 'https://Stackoverflow.com/users/52683', 'pm_score': 3, 'selected': False, 'text': '<p>It looks like there\'s hope on the horizon for those of us unable to obtain Visual Assist:</p>\n\n<p><a href="http://blogs.msdn.com/vcblog/archive/2009/05/27/rebuilding-intellisense.aspx" rel="noreferrer">Rebuilding Intellisense</a></p>\n'}, {'answer_id': 3938733, 'author': 'TW Burger', 'author_id': 476442, 'author_profile': 'https://Stackoverflow.com/users/476442', 'pm_score': 2, 'selected': False, 'text': '<p>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:</p>\n\n<p>Use #pragma once to eliminate duplicate header loads</p>\n\n<p>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.</p>\n\n<p>Often it is only one class object that is affected, This shows you what files (usually headers) to look at.</p>\n'}, {'answer_id': 5455994, 'author': 'Roberto Conte Rosito', 'author_id': 357561, 'author_profile': 'https://Stackoverflow.com/users/357561', 'pm_score': 0, 'selected': False, 'text': '<p>About this problem i\'ve notice something interesting (on Visual Studio 2010):\nto solve this problem i\'ve changed <code>#include</code> sintax in my header files, before was (old project done with VS 2005 and reopened using VS 2010):</p>\n\n<pre><code>#include &lt;myfile.h&gt; \n</code></pre>\n\n<p>and i fix this with:</p>\n\n<pre><code>#include "myfile.h"\n</code></pre>\n\n<p>After intellisense start working correctly!\nI hope this can help!</p>\n'}, {'answer_id': 5961393, 'author': 'Simon', 'author_id': 466704, 'author_profile': 'https://Stackoverflow.com/users/466704', 'pm_score': 0, 'selected': False, 'text': '<p>I had to reset the settings...</p>\n\n<p>C:\\Program Files\\Microsoft Visual Studio 9.0\\Common7\\IDE>devenv.exe /ResetSettings</p>\n\n<p><a href="https://stackoverflow.com/questions/178846/visual-studio-intellisense-stopped-working">thread on this here</a> </p>\n'}, {'answer_id': 6212905, 'author': 'Francesco', 'author_id': 780887, 'author_profile': 'https://Stackoverflow.com/users/780887', 'pm_score': 1, 'selected': False, 'text': "<p>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! \nI was using the:</p>\n\n<pre><code>#ifndef CLASS_H\n#define CLASS_H\n...\n#endif\n</code></pre>\n\n<p>to avoid redefinition of symbols, and this sometimes breaks intellisense in big projects.</p>\n\n<p>But it is enough to comment the ifndef-define-endif and put a: </p>\n\n<pre><code>#pragma once \n</code></pre>\n\n<p>at the beginning of the header files to still avoid redefinitions and have Intellisense working again =)=)</p>\n\n<p>At least, this worked for me, hope it's useful...                        </p>\n\n<p>Cheers\nFrancesco</p>\n"}, {'answer_id': 20397412, 'author': 'the swine', 'author_id': 1140976, 'author_profile': 'https://Stackoverflow.com/users/1140976', 'pm_score': 1, 'selected': False, 'text': '<p>I have recently studied Intellisense in VS2008, as I\'m developing a rather large C++ numerical linear algebra library where templates and such are used extensively. Intellisense stopped working shortly into the project and I sort of gave up, but now it became really annoying without it so I set to investigate. This is what I found out:</p>\n\n<p>Assuming there is a file(s), containing code that "breaks" Intellisense,</p>\n\n<ul>\n<li>if header files that break Intellisense are in the project, but are not <code>#include</code>d, it still works in the rest of the files</li>\n<li>if they are included, but no type declared inside is used, it still works</li>\n<li>if they are included and a type declared inside is used, it might still work a bit (no Intellisense for members, no Intellisense after occurrence of given type, but at least global names and argument info before)</li>\n<li>if Intellisense is broken in one .cpp file, it can still work in the others where the problematic code is not included or used (but i imagine if it crashes bad, it will get disabled for the whole project, although that did not happen to me)</li>\n<li>Intellisense seems to be updated after successful compilation (sometimes not before)</li>\n<li>putting broken code inside any of <code>#if 0</code>, <code>/* .. */</code> or <code>//</code> seems to put Intellisense at ease</li>\n</ul>\n\n<p>From the C++ features I used, actually only a few break Intellisense:</p>\n\n<ul>\n<li>comparison with \'>\' or \'>=\' in template parameter (e.g. <code>static_assert&lt;(size &gt; 0)&gt;</code>)\n<ul>\n<li>not solved by using double parentheses (<code>static_assert&lt;((size &gt; 0))&gt;</code> does not help)</li>\n<li>solved by using \'&lt;\' or \'&lt;=\' instead (<code>static_assert&lt;0 &lt; size&gt;</code> works)</li>\n<li>solved by storing the value in enum and using that to specialize the template</li>\n</ul></li>\n<li>explicit function template specialization disables argument info (e.g. <code>function&lt;type&gt;(args)</code>)\n<ul>\n<li>probably unable to solve (maybe wrap in a macro), but I can live with it being broken</li>\n</ul></li>\n<li>instantiation of template member type, such as <code>Matrix::MakeMatrixType&lt;3, 3&gt;::Result r;</code>\n<ul>\n<li>kind of hard to figure out exactly why this happens (likely because of use of Eigen)</li>\n<li>workaround by moving such code in a separate .cpp where IS won\'t work (not always possible)</li>\n</ul></li>\n</ul>\n\n<p>It would seem that some of those problems are due to some "simplified" parsing, which is less strong than a proper C++ parser. With the above information at hand, a "reliable" method of making Intellisense work in an existing code:</p>\n\n<ol>\n<li>Set up an empty project (a console app), create Main.cpp with dummy <code>void main() {}</code> in it.</li>\n<li>Include one of your broken header files, and <code>math.h</code></li>\n<li>Build (it must compile, in order for Intellisense to update reliably)</li>\n<li>Test whether Intellisense is working by typing e.g. <code>sin(</code> and seeing if argument help pops up. Sometimes, this would work, but member help wouldn\'t - so try that as well.</li>\n<li>Make an instance of something in the header file, build, see if that manages to kill IS.</li>\n<li>Remove code from the culprit file and go to step 3</li>\n<li>After finding and fixing problematic code, put back code removed in step 5, try again</li>\n<li>After making a whole class work well, make an instance of the next class, and so on ...</li>\n</ol>\n\n<p>I found it easy this way to pinpoint locations of code that made problems (I realize that this might be unfeasible for really large projects, in my case only a single file out of 97 made problems). Note that \'Build\' here refers to compiling, the linking stage does not need to finish, so unresolved externals are ok, the IS should update regardless.</p>\n\n<p>Another method of updating IS (other than building) is to save everything, close workspace, delete .ncb file and reopen it. Then wait for \'Updating Intellisense ... (N)\' to disappear from the status bar (N counts towards zero, if it doesn\'t go all the way, it kind of shows progress where problems occurred). I found this rather tedious.</p>\n'}, {'answer_id': 21726772, 'author': 'Aaron Middleton', 'author_id': 3301397, 'author_profile': 'https://Stackoverflow.com/users/3301397', 'pm_score': 0, 'selected': False, 'text': '<p>The problem is with the .vcproj files.</p>\n\n<p>You will find if you switch to release mode from debug mode, build, then try intellisense it often works.</p>\n\n<p>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 "../..".</p>\n\n<p>Reopen your project, let the Intellisense finish building, then it should be fixed.</p>\n'}]
['https://Stackoverflow.com/questions/39474', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/986/']