有没有办法让 Eclipse 识别每个构建配置的虚拟定义?

发布于 2024-08-15 02:41:29 字数 183 浏览 5 评论 0原文

我正在开发一个继承的 Borland C/C++ 项目,该项目的许多功能都隐藏在 #ifdefs 后面,这些功能依赖于传递给编译器的定义。 我一直在尝试让 Eclipse 通过使用每个配置符号来激活这些部分,但是当我查看源文件时,大部分部分仍然是灰色的。 有没有办法告诉 Eclipse 这些定义,以便我可以更改构建配置并查看哪些代码部分正在正确编译?

I am working on an inherited Borland C/C++ project and a lot of the project's functionality is hidden away behind #ifdefs which rely on defines passed to the compiler.
I have been trying to get eclipse to activate these sections by using per-configuration symbols however when i view the source files, large sections are still greyed out.
Is there any way to tell eclipse about these defines so I can change my build configuration and see which sections of code are being compiled properly?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半窗疏影 2024-08-22 02:41:29

此链接是否指向此线程中描述的问题

<块引用>

问题很可能是在包含搜索路径中找不到您指定的文件。
macro-include-files 之间的区别在于:
- 仅对宏文件进行预处理(即提取宏定义),而
- 包含文件实际上被解析(即声明也被提取)。

这些选项应该像 gcc 的 -imacro-include 命令行选项一样工作。

我现在看到问题了。
我关闭了该项目的索引器。
因此找到了文件本身,但它的缓冲区是空的,因为它无法在索引中找到该文件。

在深入研究代码后,我发现我可以在 C/C++ 首选项页面中打开“生成大纲视图时遵循未索引的头文件”选项,然后它会正确解析宏文件。


或者它是否与最近的错误有关,例如 bug 197989? (当标头多次包含时,快速索引器可能不准确)

Is this link to the problem described in this thread?

most likely the problem is that the files you are specifying are not found on the include search path.
The difference between macro- and include-files is that:
- macro files are preprocessed only (i.e. macro definitions are extracted) whereas
- include files are actually parsed (i.e declarations are extracted also).

These options should work just like the gcc's -imacro and -include commandline options.

I see the problem now.
I had the indexer turned off for the project.
So the file itself was found but the buffer for it was empty because it couldn't locate the file in the index.

After digging around in the code a bit, I found that I could turn on the "Follow unindexed header files when producing the outline view" option in the C/C++ preference page, and then it would parse the macro file correctly.


Or is it related to more recent bugs like bug 197989? (fast indexer may not be accurate when header included multiple times)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文