Pages: 1
Author Topic: string and ini_read_string not implemented, or is it just LateralGM?  (48,158 Views)
Offline (Unknown gender) tildearrow

Member
Joined: May 2016
Posts: 2
View profile
Posted on: May 09, 2016, 03:48:21 AM
Hey there. I've been searching for some stuff, until I saw a screenshot of LateralGM, and learned about this software.
I've been using it recently, mostly to convert my GM:S projects (and also to get rid of GameMaker: Studio and all its restrictions).

But I got into a major issue.

For some reason, I can't use ini_read_string:
Unknown function or script `ini_read_string'

nor at least string:
Unknown function or script `toString'

I wonder if this is a bug in LateralGM, or if they really aren't implemented.

Steps to Reproduce:

  • Open LateralGM.
  • Add an object, and insert a=string(1); in the code.
  • Add a room, and put that object.
  • Try to run the game.

What can I do in this case?
(yes, I'm using latest enigma and LateralGM)
(yes, I'm using latest openjdk (sorry):
openjdk version "1.8.0_92"
OpenJDK Runtime Environment (build 1.8.0_92-b14)
OpenJDK 64-Bit Server VM (build 25.92-b14, mixed mode)

)
(btw, Linux linux 4.1.15-rt17-1-rt-fixedtimers #1 SMP PREEMPT RT Sat Jan 16 01:14:52 GMT+5 2016 x86_64 GNU/Linux)
Offline (Unknown gender) Goombert

Developer
Joined: Jan 2013
Posts: 2,991
View profile
Reply #1 Posted on: May 09, 2016, 06:45:20 AM
Actually, "insert a=string(1);" in the create event of an object does work, I just tested on Windows 10. You have a bigger problem going on. Is this the first time you've used ENIGMA in a while? Did you use it on a different PC before? Also, we do not support OpenJDK because it has terrible issues with running Swing (LateralGM) applications. I would recommend installing the Oracle JDK.
Offline (Unknown gender) Garo

Member
Joined: Sep 2014
Posts: 22
View profile
Reply #2 Posted on: May 09, 2016, 04:23:07 PM
I get the same issue on Linux with the latest master branch.
Offline (Unknown gender) Josh @ Dreamland

Prince of all Goldfish
Developer
Joined: Feb 2008
Posts: 2,950
View profile
Reply #3 Posted on: May 09, 2016, 11:14:43 PM
I'm sorry; I see the same problem on my Arch Linux install. I can only guess what's causing it, as the only error reported is a lack of support (by JDI) for C++11.

You can work around the issue temporarily by placing this at the top of SHELLmain.cpp:

Code (cpp) Select

#ifndef JUST_DEFINE_IT_RUN
  #include <string>
#else
  #define _GLIBCXX_STRING 1
  template<typename T, typename traits = int> class basic_string {};
  typedef basic_string<char> string;
#endif


That's really ugly, and I always hoped no one would ever have to do that, but I can't tell why this is failing, and a proper fix seems far off.
Offline (Unknown gender) tildearrow

Member
Joined: May 2016
Posts: 2
View profile
Reply #4 Posted on: May 10, 2016, 04:11:23 AM
Quote from: Josh @ Dreamland on May 09, 2016, 11:14:43 PM
I'm sorry; I see the same problem on my Arch Linux install. I can only guess what's causing it, as the only error reported is a lack of support (by JDI) for C++11.

You can work around the issue temporarily by placing this at the top of SHELLmain.cpp:

Code (cpp) Select

#ifndef JUST_DEFINE_IT_RUN
  #include <string>
#else
  #define _GLIBCXX_STRING 1
  template<typename T, typename traits = int> class basic_string {};
  typedef basic_string<char> string;
#endif


That's really ugly, and I always hoped no one would ever have to do that, but I can't tell why this is failing, and a proper fix seems far off.

Thank you for helping. Now everything works alright.
Offline (Unknown gender) TheExDeus

Developer
Joined: Apr 2008
Posts: 1,860
View profile
Reply #5 Posted on: May 10, 2016, 06:16:34 AM
Lack of C++11? Which versions of gcc you guys are having? Please "gcc -v".
Offline (Unknown gender) Garo

Member
Joined: Sep 2014
Posts: 22
View profile
Reply #6 Posted on: May 10, 2016, 09:40:34 AM
gcc version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2)

I believe the C++11 standard was complete since 4.8.1, right?
Offline (Unknown gender) Goombert

Developer
Joined: Jan 2013
Posts: 2,991
View profile
Reply #7 Posted on: May 10, 2016, 11:49:24 AM
Yes but the problem is that they might have changed something in some standard header. Josh wrote JDI which parses the code and then feeds it to gcc to compile as C++, so JDI makes GCC a little more like Clang/LLVM. Part of the reason Clang/LLVM is becoming more popular is that it gives you more access to the compiler's internals. Anyway, JDI never got very good template support, because Josh is very busy much of the time. What might have happened to cause this is that somebody maintaining <string> in GCC could have changed something that made JDI unable to parse it, so it ended up ignoring the rest of SHELLmain.cpp and thus why nothing else can be found.
Offline (Unknown gender) Josh @ Dreamland

Prince of all Goldfish
Developer
Joined: Feb 2008
Posts: 2,950
View profile
Reply #8 Posted on: May 10, 2016, 11:19:23 PM
What Robert is trying to say is that contained within ENIGMA's compiler is the parser part of a C++ compiler, which I called "Just Define It" (JDI). For ENIGMA's syntax checking and EDL parsing to work, JDI has to be able to read the engine file, as a C++ compiler would. While I coded in some support for C++11 when I wrote JDI, the specification was new at the time, and I didn't feel like meddling in it. So even though JDI has some C++11 features, I believe it's missing enough of them that I never told it to advertise support for the specification—it sets __cplusplus to reflect support only for like C++98/03.

This has never been a problem, because (A) all the STL headers are SUPPOSED to compile under C++98, and (B) the features of C++11 that you enjoy (and are using in ENIGMA) are blindingly easy to support in compilers, so I supported them. This was somewhat perforce, as GNU C++ has supported the bulk of these features since the dawn of time. That said, harder constructs, such as variadic template parameters, are missing from JDI, and I have no intentions of adding them. If you use them in ENIGMA's engine, this will create problems for the current compiler.

Since C++98 is still a thing, I don't know why JDI has suddenly been rendered incapable of parsing <string> correctly. I also don't know why it's printing only one error... did someone suppress the rest of them? I can't make a diagnosis without them. Still, I suspect it doesn't matter; no one actually relies on JDI knowing what string can do, as evidenced by the above working.
Pages: 1