Cannot name a variable "time" on Linux

Reporter: tgdc  |  Status: closed  |  Last Modified: April 23, 2019, 05:40:11 PM

In file included from SHELLmain.cpp:106:0:
/home/user/.enigma/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:2590:15: error: invalid conversion from ‘time_t ()(time_t) throw () {aka long int ()(long int) throw ()}’ to ‘int’ [-fpermissive]
if((timer > time))
^~~~
rm -f /home/user/.enigma/.eobjs/Linux/Linux/GNU_GCC_G++/Run/Universal_System/loading.o /home/user/.enigma/.eobjs/Linux/Linux/GNU_GCC_G++/Run/Universal_System/Extensions/MotionPlanning/motion_planning.o
make[1]: Leaving directory '/home/user/enigma-dev/ENIGMAsystem/SHELL'
Makefile:19: recipe for target 'Game' failed
make: *** [Game] Error 2
RobertBColton  
This is a piece of GML from your project that was converted to C++.

if((timer > time))

You could try changing the names of the "time" variable because ENIGMA may be confusing it with the C++ time type, as indicated by the error message. It would also be helpful to see a larger piece of the script/GML code if you could provide it.

RobertBColton  

Ok, I can't reproduce this on Windows but I asked Josh who kindly pointed it out to me that time happens to be a function on Linux but not Windows. So it's complaining that it can't cast time to an int because it's a function pointer. We'll look at getting this fixed, for now you can work around it by renaming your time variable.
JoshDreamland  

In the interim, you can work around this by declaring time as a local, explicitly, (local int time;) or by using a different name.
fundies  

this should be fixed by #1677
Please sign in to post comments, or you can view this issue on GitHub.