使用Visual Studio中时错误地标记处于非活动状态code块`#ifdef` [英] Visual Studio incorrectly marking inactive code blocks when using `#ifdef`

查看:2036
本文介绍了使用Visual Studio中时错误地标记处于非活动状态code块`#ifdef`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目有一堆的#ifdefs 的。这些 #IFDEF 取值使用的宏通常是通过命令行使用'/ D'选项以获得通过不同的构建配置。 Visual Studio中错误地假定这些宏没有定义和灰色了code块内部的这些 #IFDEF 取值present。问题不在于语法高亮 - 我可以把灰色的code从选项有色code;主要的问题是,我不能够去里面的任何职能present #IFDEF 的函数定义。我试着阅读有关Visual Studio 提示文件但没有对工作我的。

My project has a bunch of #ifdefs. The macros used by these #ifdefs are usually passed through the command line using the '/D' option to get different build configurations. Visual studio incorrectly assumes that these macros are not defined and greys out the code blocks present inside these #ifdefs. The problem is not syntax highlighting - I can turn the grayed out code to colored code from Options; the main issue is that I am not able to go to the function definition of any functions present inside that #ifdef. I tried reading about Visual Studio hint files but that didn't work for me.

谁能帮我这个问题?我使用Visual Studio 2008。

Can anyone help me with this issue? I am using Visual Studio 2008.

推荐答案

你定义了几种在VS建立像调试,发布配置,或者是你的makefile构建?如果你还没有VS教你/ D选项的话,我想它不能帮助你。但是,你应该能够下设项目属性preprocessor定义(配置属性,C / C ++,preprocessor),以获得您想要的效果吧?

Did you define several kinds of builds within VS as Configurations like Debug, Release, or are you building with makefiles? If you haven't taught VS about your /D options then I guess it can't help you. But you should be able to set up Preprocessor Definitions under project properties (Configuration Properties, C/C++, Preprocessor) to get the effect you want, right?

对于每个选项 / DMACRO = XXX 传递给编译器,指定 MACRO = XXX 中的智能感知preprocessor定义。对于每一个选项 / DMACRO (没有值)传递给编译器,指定 MACRO 在智能感知preprocessor定义。

For each option /DMACRO=XXX that you pass to the compiler, specify MACRO=XXX in the IntelliSense Preprocessor Definitions. For each option /DMACRO (no value) that you pass to the compiler, specify MACRO in the IntelliSense preprocessor definitions.

这篇关于使用Visual Studio中时错误地标记处于非活动状态code块`#ifdef`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆