Eclipse Luna CDT:什么是标头变体? [英] Eclipse Luna CDT: What is a header variant?

查看:77
本文介绍了Eclipse Luna CDT:什么是标头变体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难让Eclipse Indexer(Codan)识别头文件中的某些数据声明.对为所有标头变体编制索引,有了一个新的首选项,但是几乎没有什么解释这表示.启用首选项似乎可以解决此问题.但是我仍然想知道首选项的确切作用.

I am having difficulty getting the Eclipse Indexer (Codan) to recognize certain data declarations in header files. There is a new preference to Index all header variants, but little explanation as to what this means. Enabling the preference seems to fix the problem. But I still would like to know what the preference does exactly.

推荐答案

假设您有标题 a.h 这样的标题:

Let's say you have header a.h like this:

#pragma once

#ifndef SYMBOL
#define SYMBOL int
#endif

struct S
{
  SYMBOL sym;
};

现在,如果您包括这样的标题:

And now if you include your header like this:

struct UserSymbol
{
  int i, j, k;
};

#define SYMBOL UserSymbol

#include "a.h"

S var;

int main()
{
  var.sym.i = 123;
  return 0;
}

然后Eclipse CDT可能无法识别 sym.i .

then Eclipse CDT may not to recognize sym.i.

您可能拥有更复杂的示例,其中包含更深层的嵌套包含物.

You may have more complex examples with deeper nested inclusions or so on.

但是,如果将 ah 包含在为特定标头的所有变体编制索引"列表中,或选中为所有标头的所有变体编制索引",则Eclipse将构建 ah 的多个变体索引并知道"您已定义了特定的 SYMBOL .

But if you include the a.h to the "Index all variants of specific headers" list or check "Index all header variants" Eclipse will build several variants of the a.h indexes and will "know" that you have defined the your specific SYMBOL.

这篇关于Eclipse Luna CDT:什么是标头变体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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