Enum declaration isn't working

Reporter: 9Morello  |  Status: open  |  Last Modified: July 24, 2018, 10:00:24 AM

So, I've started an empty project and created a script with the following:

enum Test

LateralGM sees no problem with this syntax. However, running it (with a new object with this script in the started event) results in an error:

C:/Users/Imouto/AppData/Local/ENIGMA/.eobjs/Windows/Windows/Mingw_GCC_G++/Run/SHELLmain.o SHELLmain.cpp
In file included from SHELLmain.cpp:106:0:
C:/Users/Imouto/AppData/Local/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h: In function 'variant _SCR_scr_0(variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant)':
C:/Users/Imouto/AppData/Local/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:41:10: error: 'varaccess_Test' does not name an enumeration in 'enigma'
     enum enigma::varaccess_Test(int(self));
C:/Users/Imouto/AppData/Local/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:41:18: error: 'varaccess_Test' in namespace 'enigma' does not name a type
     enum enigma::varaccess_Test(int(self));
In file included from SHELLmain.cpp:105:0:
C:/Users/Imouto/AppData/Local/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectaccess.h:52:9: note: 'var& enigma::varaccess_Test(int)' declared here
   var  &varaccess_Test(int x)
In file included from SHELLmain.cpp:106:0:
C:/Users/Imouto/AppData/Local/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:41:33: error: expected unqualified-id before 'int'
     enum enigma::varaccess_Test(int(self));
C:/Users/Imouto/AppData/Local/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:41:33: error: expected ')' before 'int'
C:/Users/Imouto/AppData/Local/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h: In member function 'variant enigma::OBJ_obj_0::_SCR_scr_0(variant, variant, variant, variant, variant)':
C:/Users/Imouto/AppData/Local/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:70:8: error: use of enum 'Test' without previous declaration
   enum Test;
rm -f C:/Users/Imouto/AppData/Local/ENIGMA/.eobjs/Windows/Windows/Mingw_GCC_G++/Run/Universal_System/loading.o C:/Users/Imouto/AppData/Local/ENIGMA/.eobjs/Windows/Windows/Mingw_GCC_G++/Run/Universal_System/Extensions/MotionPlanning/motion_planning.o
make[1]: Leaving directory '/home/Imouto/enigma-dev/ENIGMAsystem/SHELL'

This is the test file I used:

Are enums expected to work right now? Does the syntax differ in any way from GMS1.4/C++?

No, enums are not expected to work right now, this is a confirmed JDI issue we'll have to look at because we do want enums. Hopefully Josh will be able to create some magic if he finally finds the motivation to pull off merging in his newer JDI. I can and will ask him about the possibility of a workaround in the current JDI.

Issue there is pretty obvious, it thinks enum Test is like a var Test declaration, that's clearly not what it is. You may be able to use enums in Build->Definitions or wherever that is located. Though, understand the current EGM format we are still working on replacing.

Please sign in to post comments, or you can view this issue on GitHub.