有没有办法 #define 仅在 Eclipse 编辑器窗口中定义的 C 宏?
我使用 Eclipse Galileo 和 CDT 进行针对嵌入式设备的 C 开发。
与许多其他针对 µcontroller 的编译器一样,IAR 编译器使用一些 Eclipse/CDT 无法识别的非标准变量类型,并将它们标记为问题。由于这些变量类型是其他变量类型的基础,因此我使用问题级联,几乎所有使用非标准类型声明的变量的行都被标记为存在语法问题,即使语法是正确的。这不是一个关键问题,但绝对是一个麻烦。
Eclipse/CDT 中是否有一个可以添加非标准语法的设置,或者...
- < p>Eclipse/CDT 中是否有一些预定义的宏,我可以使用诸如 #ifdef SECRET_ECLIPSE_MACRO ... 之类的内容来访问,以便使用有问题的变量类型定义的字符串有条件地设置或清除宏? p>
I'm using Eclipse Galileo with CDT for C development targeting embedded devices.
Like so many other compilers targeted at µcontrollers, the IAR compiler uses some non-standard variable types that Eclipse/CDT doesn't recognize and flags them as problems. Since these variable types are the foundations of other variable types I use the problem cascades to the point that just about every line using variables declared with the non-standard types are flagged as having syntax problems, even when the syntax is correct. It's not a critical problem, but it is definitely a nuisance.
Is there a setting within Eclipse/CDT where I can add non-standard syntax, or...
Is there some predefined macro within Eclipse/CDT that I can access with something like
#ifdef SECRET_ECLIPSE_MACRO ...
for conditionally setting or clearing a macro with the string of the offending variable type definition?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
好吧,你也可以反过来。在编译代码时定义一个
NOT_ECLIPSE
宏,并检查代码中是否存在该宏。如果未定义,则您处于 Eclipse 中。Well, you can go the other way around. Define a
NOT_ECLIPSE
macro when you compile your code, and check for its non-existence in your code. If it's not defined, you're in Eclipse.,有很多。
请参阅此页。
http:// help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.cdt.doc.user/reference/cdt_u_prop_build_variables.htm
不要忘记检查“显示系统变量”选项。
Yes, there are many.
See this page.
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.cdt.doc.user/reference/cdt_u_prop_build_variables.htm
Don't forget to check the 'SHow system variables' option.
在 CDT 编辑器预处理阶段定义(至少适用于 Indigo SR2)
is defined during CDT editor preprocessing stage (works at least with Indigo SR2)