GCC only: "Unknown function or script `toString'"

Reporter: faissaloo  |  Status: open  |  Last Modified: September 13, 2016, 07:01:19 PM

This only happens in the Linux version, I have made sure my copy of the Windows version is up to date and tested this (just a room with string(8) in its creation code) and it doesn't happen.

Syntax error in room creation code for room 0 (`rm_0'):
Line 1, position 10 (absolute 9): Unknown function or script `toString'
What is in that creation code? I don't think we generate any default code for rooms... and if we do, it's probably not using string(). We use a macro to change string() (as a function call) to toString(). This allows string alone to remain a type (even though something has since broken that, as I understand).

Has someone deleted/renamed toString? They're no longer needed since C++11 added std::to_string, but the macro needs updated if they've been removed... Also, we probably still want them to avoid overloading STL functions to support var/variant.


Just string(8), this happens regardless of where string(8) is in the game, whether it be in draw code, step, etc.


I managed to misread the error. It's an ENIGMA syntax error, not a compile error…. That's really weird. I can't imagine why JDI is missing its declaration, especially only on Linux; there's nothing clever or unusual about how or where it's declared. And I know we have lots of other functions that aren't migrated to enigma_user, including on Linux, so I'm not sure why it's affected.

I notice that at the top of the header that declares it is this:

#ifndef __libegmstd_h
#define __libegmstd_h

Can you try replacing __libegmstd_h which LIBEGMSTD_h? There's a tiny chance that this is conflicting with some system header. Shouldn't be the case, but who knows. I don't see anything else that could cause this weird behavior.


Nope, still not working.


The file's included right from line 67 of SHELLmain... there's just no reason JDI should be missing it. Since we're low on options, can you try moving it up toward the top? As far as I can tell, it's fine if it's as high as line 29. If that works, we can diagnose what's happening to those functions later. I already checked if someone was #define'ing them, but only saw a few instances in Robert's old Bullet code.


Nope, same error.


I think this might be related:

Line 17, position 24 (absolute 242): Unknown function or script `string_char_at'

This has to be a new issue because I'm getting this from a game that I wrote a few months ago in ENIGMA.


We've been having some bizarre issue with std::string on Linux with the latest GCC; I posted a workaround on the forums. Perhaps you're being affected by a less severe equivalent....


Yup, that fixes it.


These issues could be caused by the changes to toString that @faissaloo pointed out in #1001

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