如何让 Eclipse 索引 #ifdef .... #endif 中的代码 [英] How can I get Eclipse to index code inside #ifdef .... #endif

查看:12
本文介绍了如何让 Eclipse 索引 #ifdef .... #endif 中的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 eclipse 来处理一些 c 代码,它没有像这样在条件编译块内索引代码:

I'm using eclipse to work on some c code and it is not indexing code inside conditional compilation blocks like this:

#ifdef USE_FEATURE_A
int feature_a(...) {
   some = code(here);
}
#endif

如何让 eclipse 索引 feature_a 函数?

How can I get eclipse to index the feature_a function?

推荐答案

您可以告诉 Eclipse USE_FEATURE_A 已定义.打开您的项目属性并转到C/C++ General->Paths and Symbols"页面,在Symbols"选项卡下单击Add"按钮并将 USE_FEATURE_A 放在名称字段中,然后单击确定".

You could tell eclipse that USE_FEATURE_A is defined. Open your project properties and go to the "C/C++ General->Paths and Symbols" page, under the "Symbols" tab click the "Add" button and put USE_FEATURE_A in the name feild and click OK.

注意:这将导致它不会索引任何 #else 方面到你的预处理器的东西......所以除非它们都像有问题的那个你不能AFAIK,但如果它们是他们你很好.(Eclipse 包含一个 C 预处理器,它用于分析您的代码上述所有内容与在命令行中添加 -DUSE_FEATURE_A 本质上相同,因此 Eclipse 的预处理器的行为将与编译器中的预处理器不同)

Note: this will cause it not to index any #else sides to your preprocessor stuff... so unless they are all like the one in question you can't AFAIK, but if they are they you're good. (Eclipse contains a C preprocessor that it uses to analyize your code all the stuff above does is essentially the same as adding -DUSE_FEATURE_A to your command line so Eclipse's preprocessor will behave differently from the one in your compiler)

这篇关于如何让 Eclipse 索引 #ifdef .... #endif 中的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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