Eclipse CDT无法正确跟踪宏定义 [英] Eclipse CDT Does not track macro defines correctly

查看:74
本文介绍了Eclipse CDT无法正确跟踪宏定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在构建设置中,我在调试构建配置中定义了 DEBUG ,这样我就可以根据自己的构建类型,使我的代码做一些单独的事情.

In the build settings I have it define DEBUG when in the debug build configuration, so that I may make my code do separate things depending on which type of build it is.

但是,在Eclipse中,它会使预处理器所排除的代码部分变暗,并且当我更改设置时(无论我当前是在构建调试还是发布),这种情况也不会消失.因此,我有一堆永久消失的代码,并且Eclipse索引器和其他有用的功能在这些区域内不起作用.

However in Eclipse it darkens out the parts of the code which are excluded by the preprocessor, and this doesn't keep up when I change the setting (whether I'm currently building debug or release). So, I have a bunch of code which is perpetually darkened out, and the Eclipse indexer and other helpful features don't work inside of those areas.

如何解决?有人遇到过这种情况么?

How to fix? Has anyone else encountered this?

更新:仍然存在此问题.我最终放弃了单元测试的构建配置,而只是将该功能放入命令行开关中.只是为了在编写单元测试时可以使索引工作.

Update: Still having this issue. I eventually abandoned my unit-test build configs and simply put that functionality into a command-line switch. Just so that I could get indexing to work while I write my unit tests.

推荐答案

您必须在项目C/C ++索引器首选项中将索引器的构建配置"选项设置为使用活动的构建配置".打开项目的属性面板,转到c/C ++ General和Indexer并启用项目特定的设置,然后将底部的单选按钮更改为使用Active构建配置".

You have to set the option "Build configuration for the indexer" to "Use active build configuration" in the projects C/C++ indexer preferences. Open the properties panel for the project, go to c/C++ General and Indexer and enable project specific settings and change the radiobutton on the bottom to "Use Active build configuration".

当然,您也可以在Eclipse的全局属性面板中进行设置,以更改所有项目的设置.

Of course you can also set this in the global properties panel of Eclipse to change this setting for all projects.

这篇关于Eclipse CDT无法正确跟踪宏定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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