如何获取eclipse来识别预处理语句? [英] How to get eclipse to recognize preprocessor statements?

查看:621
本文介绍了如何获取eclipse来识别预处理语句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设法使IDE通过修改config.ini来正确编译java项目,但IDE本身仍然显示有关处理器语句的错误:

  //#ifdef VER_X 
public class Video extends FirstCanvas {
//#else
public class Video extends SecondCanvas {
// #endif
...

是否有可以解决的设置或插件这个?



编辑:也许有一点澄清:我正在寻找一些能使IDE编辑器更符合代码的东西。由于编辑器THINKS的错误,它不会让我遵循任何定义。

解决方案

更多的OO方法使用单独的类,在运行时在它们之间进行选择:

  public class FirstVideo extends FirstCanvas {
...
}

public class SecondVideo extends SecondCanvas {
...
}

...
video =(something?new FirstVideo ():new SecondVideo());

这不需要非标准的编译步骤来实现并且不会打开eldritch的门C / C ++预处理指令的恐怖。


I've managed to get the IDE to compile the java project correctly by modifying the config.ini, but the IDE itself is still showing errors concerning the processor statements:

//#ifdef VER_X
public class Video extends FirstCanvas {
//#else
public class Video extends SecondCanvas {
//#endif
...

Is there a setting or a plug-in that would solve this?

EDIT: Maybe a little clarification: I'm looking for something that will make the IDE editor more compliant with the code. It won't let me follow any definitions because of what the editor THINKS are errors.

解决方案

A more OO approach to this would use separate classes, selecting between them at runtime:

public class FirstVideo extends FirstCanvas {
   ...
}

public class SecondVideo extends SecondCanvas {
   ...
}

...
video = (something ? new FirstVideo() : new SecondVideo());

This does not require non-standard compilation steps to achieve and doesn't open the door to the eldritch horrors of C/C++ preprocessor directives.

这篇关于如何获取eclipse来识别预处理语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆