Visual Studio incorrectly marks inactive code blocks when using `# ifdef`

There is a group in my project #ifdefs. The macros used by these #ifdefare usually passed through the command line using the option '/D'to get different build configurations. Visual studio incorrectly assumes that these macros are undefined and allocate blocks of code that are present inside these #ifdefs. The problem is not syntax highlighting - I can turn gray code into color code from Options; the main problem is that I cannot go on to defining the function of any functions present inside #ifdef. I tried to read file hints about Visual Studio , but this did not work for me.

Can someone help me with this problem? I am using Visual Studio 2008.

+3
source share
2 answers

Have you defined several types of builds in VS as configurations, such as Debug, Release, or are you building with makefiles? If you have not taught VS about your / D options, I think this will not help you. But you should be able to configure Preprocessor Definitions in the project properties (Configuration Properties, C / C ++, Preprocessor) to get the desired effect, right?

/DMACRO=XXX, , MACRO=XXX IntelliSense. /DMACRO ( ), , MACRO IntelliSense.

+2

, intellisense - , #define, IDE .

, , :

intellisense VS2008 , #ifndef... #endif

0

Source: https://habr.com/ru/post/1771981/


All Articles