Kami Kaze
Kami Kaze

Reputation: 2080

creating a define only used by eclipse

I have project that was created in another IDE that is build for a specific microcontroler. In the code faris used quite often and it is comprehended by the IDE and compiler.

I would like to use eclipse to edit the code, because it is more convinient to use. But it generates a lot of warnings and errors in the editor because he can not resolve the far.

I could create a macro #define far, but I would have to remove it when I want to compile the code. I don't compile with eclipse, because getting the compiler to work there is cumbersome and might introduce problems.

So is there a possibility that eclipse itself can handle the far for its syntax check?

Upvotes: 1

Views: 163

Answers (2)

Kami Kaze
Kami Kaze

Reputation: 2080

After I searched a bit more I found an answer here: https://www.eclipse.org/forums/index.php/t/72375/

Go to the menu:

Project -> Properties -> C/C++ General -> Path and Symbols -> Symbols

and add a Symbol called far with the value /* */.

I just left the value empty and it worked.

Upvotes: 0

HighCommander4
HighCommander4

Reputation: 52779

Another approach that involves modifying your code rather than the project settings would be:

#ifdef __CDT_PARSER__
#define far
#endif

__CDT_PARSER__ is a macro that is automatically defined by CDT's parser when it processes your code, but not by any compiler.

Upvotes: 1

Related Questions