11

This question refers to version 1.2.1 and it doesn't compile at a different part so it's not a duplicate.

I want to use enums in Processing. I've read they work better in a separate file so I have done that. This code compiles correctly:

enum Status
{
    STOPPED,MOVING
};

But when I have this code

Status status;

in a different file it gives me the following error:

Unrecognized type:46 (ENUM_DEF)

I know enums aren't supported in earlier versions of Processing but are they supported in version 2.0? If so what's cause the error?

Community
  • 1
  • 1
PriestVallon
  • 1,519
  • 1
  • 22
  • 44

1 Answers1

12

When you make a new tab for your enum, are you appending .java? In your case, is your new tab named Status.java?

Your code compiles fine for me in Processing 2.0b6 with the main tab contents:

Status status;

And a new tab named Status.java with the contents:

enum Status
{
    STOPPED,MOVING
};
spex
  • 1,110
  • 10
  • 21
  • 1
    I was just missing the ".java". Thanks – PriestVallon Nov 13 '12 at 23:17
  • could you confirm that in processing 2.0b8 this solution does not work? – rano Apr 30 '13 at 08:19
  • @rano I just tested this in 2.0b8 and the solution I presented is working fine. I then also tested in the latest version 2.0.1 and it is also working fine. Make sure you are appending .java to the new tab name. – spex Jul 14 '13 at 16:11