Eclipse/CDT 编辑器未在对 ifdef 编辑的部分进行着色时拾取项目定义的符号
我看到的问题是,在首选项下,不同配置/目标的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我通过设置“窗口->首选项->C/C++->索引器->使用活动构建配置”在我的系统上解决了这个问题
I solved this problem on my system by setting 'Window->Preferences->C/C++->Indexer->Use active build configuration'
回应 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.
只是对符号选项的一小部分补充:
给它值1
对我有用的是:
感谢您的提示!
just a small addition to the symbols option:
give it value 1
what worked for me is this:
thanks for the tips !
尝试使用项目的发现选项。 (右键单击该项目,选择 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.)