开发者

Is there a way to #define a C macro that is only defined while in an Eclipse editor window?

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.

  1. Is there a setting within Eclipse/CDT where I can add non-standard syntax, or...

  2. Is there some predefin开发者_开发知识库ed 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?


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.


Is there some predefined macro within Eclipse/CDT that I can access

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_PARSER__

is defined during CDT editor preprocessing stage (works at least with Indigo SR2)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜