Enums in Processing 1.2.1?

╄→尐↘猪︶ㄣ 提交于 2019-12-12 05:42:40

问题


Here is my sketch:

enum Foo { bar, baz }

void setup() { }
void draw() { }

This fails to compile:

Unrecognized type:46 (ENUM_DEF)

Am I doing something wrong, or are enums not supported?


回答1:


Looks like they aren't supported unfortunately, but there are some workarounds. From the FAQ:

We currently only support Java 1.4 (and earlier) syntax. You cannot currently use 1.5 syntax in the Processing Development Environment. This means no generics, templates, enum, varargs, foreach, and the rest. If you want to use Java 1.5 (or later), take core.jar and develop your project with another Java IDE

If you're comfortable with Java, you can always base your project in Java and access the Processing code via traditional Java classes. The FAQ has some pointers on that too.



来源:https://stackoverflow.com/questions/5811397/enums-in-processing-1-2-1

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!