views:

18

answers:

2

In Visual Studio 2005, I have a .h file with preprocessor macros in it. They are apparently too complicated for Visual Studio's Intellisense because they make Visual Studio crash if they are present whereas it works fine if they are not. Does anyone know of a way to prevent Visual Studio parsing the file for Intellisense but still include it in the build. By the way, I have already tried the following:

  1. Disabling Intellisense by renaming feacp.dll. Works, but impractical.
  2. Visual Assist. Works, but $250.
  3. Installing Visual Studio SP1 + the Intellisense hotfix (KB947315). Doesn't fix it (and ate 1GB of hard drive space).
A: 

The first thing to try is to install Visual Studio 2005 SP1. This fixes a lot of intellisense related issues which may help you out

If that doesn't fix the problem try excluding the file from the project. This prevents it any any of it's contents from appearing in Visual Studio features (such as intellisense). If it's just a header file it shouldn't impact the build as the actual file won't be removed, it just won't be considered part of the project.

JaredPar
I have edited my question to add that I already have SP1 installed. It doesn't fix the problem. Also, removing the file from the build does not help (I have tried it already also) as VS searches the #include tree (I presume) and still finds the file.
Jack
A: 

Ok, for the benefit of others, I'm going to solve this myself! I've been fiddling and the answer is as follows. If you have this problem, and you delete your ncb file to force Intellisense to update, you can prove to yourself that this works.

#ifdef out the offending code in your .h file as follows:

#ifdef SOMETHING_UNIQUE
<the offending code>
#endif

in the file that actually uses the macros (the cpp file that #includes the .h file):

#define SOMETHING_UNIQUE

Intellisense will now ignore the code in the .h file that causes it to crash (it will be greyed out in the editor), but it still gets compiled.

Jack
Apparently I can't accept this answer for 2 more days...but it is the answer, so use it of you like!
Jack