Eclipse/CDT 编辑器未在对 ifdef 编辑的部分进行着色时拾取项目定义的符号

发布于 2024-09-03 13:56:00 字数 155 浏览 1 评论 0原文

我看到的问题是,在首选项下,不同配置/目标的 C/C++ 定义符号没有显示在代码着色中。

当我更改项目菜单中的活动构建配置时,我希望编辑器和代码着色以从项目设置中拾取符号,但它似乎只拾取目标之一的符号。

有没有办法让 ifdef 代码的代码着色遵循活动的构建配置?

The problem I'm seeing is that under preferences, C/C++ Defined symbols for different Configurations/targets aren't showing up in the code coloring.

When I change the active build configuration in the project menu, I would expect the editor & code coloring to pick up the symbols from the project settings, but it only seems to be picking up the symbols for one of the targets.

Is there any way to have the code coloring for ifdef'ed code follow the active build configuration?

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

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

发布评论

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

评论(4

不知在何时 2024-09-10 13:56:00

我通过设置“窗口->首选项->C/C++->索引器->使用活动构建配置”在我的系统上解决了这个问题

I solved this problem on my system by setting 'Window->Preferences->C/C++->Indexer->Use active build configuration'

泪意 2024-09-10 13:56:00

回应 phord 的评论。将索引器设置更改为“使用活动配置”后,您需要将项目的活动配置更改为其他内容,然后再更改回来。然后它会接受更改。

In response to phord's comment. After changing the indexer setting to "Use Active Configuration" you need to change the active conf of the project to something else and then back. Then it picks up the changes.

陪我终i 2024-09-10 13:56:00

只是对符号选项的一小部分补充:
给它值1

对我有用的是:

  • 将定义名称复制到剪贴板(假设我们有:#ifdef DBG_TYP_1)
  • 在项目资源管理器中选择项目
  • 转到-项目->属性->C/C++常规-> 路径和符号
  • ; “# Symbols”选项卡中的
  • 添加符号 DBG_TYP_1 值为 1

感谢您的提示!

just a small addition to the symbols option:
give it value 1

what worked for me is this:

  • copy the define name to clipboard(lets say we have: #ifdef DBG_TYP_1)
  • select the project in project explorer
  • go to - Project->Properties->C/C++ General->Path and Symbols
  • in the "# Symbols" tab
  • add symbol DBG_TYP_1 with value 1

thanks for the tips !

画骨成沙 2024-09-10 13:56:00

尝试使用项目的发现选项。 (右键单击该项目,选择 Properties,进入 C/C++ Build 下,然后选择 Discovery Options。)

您可能需要在更改其构建配置后重新构建项目,以便 Eclipse 重新运行其发现,或者您可能需要更改每个配置的发现选项以使它们生成不同的结果。 (抱歉,这不是我经常使用的 CDT 领域。)

Try playing around with your project's Discovery Options. (Right-click on the project, choose Properties, go under C/C++ Build, and choose Discovery Options.)

You may need to rebuild your project after changing its build configuration in order for Eclipse to rerun its discovery, or you may need to change the discovery options for each configuration to cause them to generate different results. (Sorry, this isn't an area of the CDT that I've played much with.)

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