You can enable intellisense in VS2008 as part of preprocessor blocks such as #ifndef ... #endif

While working in C ++ libraries, I noticed that I was not provided with intellisense, but inside directive blocks such as #ifndef CLIENT_DLL ... #endif. This is obviously due to the fact that "CLIENT_DLL" was defined. I understand that I can get around this by simply commenting out the directives.

Are there any intellisense options that will allow intellisense regardless of the directory evaluation?

+4
source share
5 answers

By getting what you want, you will lose a lot.

Visual C ++ IntelliSense is based on several key presumptions 1. that you want good / useful results. 2. That your current IntelliSense compiler will provide information related to the “configuration” you are currently in.

Since your current configuration has this preprocessor directive, you cannot get results from the #ifndef scope.

The reason makes sense if you are experiencing it. What if the IntelliSense compiler just tried to compile the region you were in, regardless of #ifdef regions? You will get pointless and non-compiled code. This might not be the head or tails of your compiler.

I can imagine a very complex solution, where it does a smaller (new) parsing in the region in which you are located, and only this region is considered part of the compiler. However, there are so many holes in this approach (like nothing in this region declared / defined) that this possible approach will immediately upset you, except for very simple scenarios.

As a rule, it is better to avoid logic in #ifdef areas and instead delegate the use of parameterized compilation to entire functions, so that the front-end compiler interface always compiles these modules, but the linker / optimizer chooses to return the OBJ later.

Hope this helps, Will

+3
source

Visual Studio 6.0 has slightly better support for C ++ in an arena like this. If you need intellisense, then just comment on it temporarily, build, and then you should have intellisense. Just remember to recount it when you are done, if that was your intention.

0
source

I just want Intellisense to work when it SHOULD be in VS2008. MS "workarounds" do not work (deleting .ncb files) most of the time. Ohhh, here's another discussion of SO ... let's see what IT has to say (I just love SO)

0
source

It annoys me too ... but I wonder if intellisense can really provide any useful information, in general, as part of an air-conditioned unit?

The problem that I see is that if the use of a variable or function changes depending on the value of the preprocessor directive, then it could be a definition. If code viewing functions, such as "go to definition", were active in the block with conditional output, you would like them to lead to the definition at present or to the one that was disabled using the same preprocessor conditions as disabled code at?

I think the "principle of least surprise" dictates that current behavior is the safest, most annoying, although it is.

0
source

Why do you want to explicitly specify the code? VS already has a configuration setting, and you can enable and destroy intellisense. see link.

http://msdn.microsoft.com/en-us/library/ms173379(VS.80).aspx

http://msdn.microsoft.com/en-us/library/ks1ka3t6(v=VS.80).aspx

This link can help you.

0
source

All Articles