perbone / luascript

Lua language support for Godot Engine
Apache License 2.0
629 stars 44 forks source link

Compiler Error: C2429 "requires compiler flag /std:c++17" #19

Closed Jamtoad closed 3 years ago

Jamtoad commented 4 years ago

Howdy! Whenever I attempt to build Godot with the Lua script enabled I get this error. It happens at 24% everytime and it happens on line 39, 42, and 45 of the registertypes.cpp file.

It says I am missing C++17 but Godot was able to build perfectly without it? Also at the start of the build process when building with Lua script enabled it says "C++17 overridden, proceeding with C++14" so I think something is happening to make it not use C++17.

I am running Windows, but I don't think this would make a big difference as it seems to be a problem with the Lua script itself, but I could be wrong. I installed every C++ file I could possibly find on Visual Studio and it didn't seem to make a difference.

Thank you for your time! I am sorry if I am doing this whole "Issues" thing incorrectly. I am sort of new to Github.

perbone commented 4 years ago

Hi @Jamtoad I think you are trying to compile for godot 4 and currently LuaScript has no support for it. Try the compilation for 3.2 and let me know if it works. -- Perbone

Jamtoad commented 4 years ago

I tried compiling on two separate computers in Godot 3.2.2 and they both threw the same error. I got Godot 3.2.2 from GitHub and extracted it then built it, I didn't clone then build it. I don't know if this could change things though.

perbone commented 4 years ago

So I'm gonna try a CI to build Godot with LuaScript. Can't know how long it gonna take tough. If this in place you will be able to download the executable for Windows from this repository. -- Perbone

Jamtoad commented 4 years ago

Okay sounds good, Thank you!

MetlHedd commented 3 years ago

Godot 3.2.2 set the C++ version flag as C++14: https://github.com/godotengine/godot/blob/6a9fbafcbbd7954761fb17554ed08fb62e3554dd/SConstruct#L378

And the https://github.com/perbone/luascript/blob/98c709d464d8e52c4b21a0f1be846fa2785fd7c5/SCsub#L11 does not override it.

I did some hack to make it work: https://github.com/MetlHedd/luascript/blob/master/SCsub

perbone commented 3 years ago

I don't think so, or my code would not work on my Linux machine or macOS, as I have been using C ++ 17 since the beginning.

MetlHedd commented 3 years ago

Linux works fine, the problem is with msvc, from this build: https://github.com/MetlHedd/luascript/runs/1083450623#step:8:1280

The CL compiles with the /std:c++14 flag:

cl /Fomodules\luascript\lib\antlr4\CharStream.windows.opt.tools.64.obj /c modules\luascript\lib\antlr4\CharStream.cpp /TP /std:c++14 /nologo /O2 /Z7 /MT /Gd /GR /utf-8 /W3 /wd4267 /wd4244 /wd4305 /wd4018 /wd4800 /EHsc /DDEBUG_ENABLED /DWINDOWS_ENABLED /DOPENGL_ENABLED /DWASAPI_ENABLED /DWINMIDI_ENABLED /DTYPED_METHOD_BIND /DWIN32 /DMSVC /DWINVER=0x0601 /D_WIN32_WINNT=0x0601 /DNOMINMAX /D_WIN64 /DPTRCALL_ENABLED /DTOOLS_ENABLED /DGDSCRIPT_ENABLED /DMINIZIP_ENABLED /DZSTD_STATIC_LINKING_ONLY /DGLAD_ENABLED /DGLES_OVER_GL /DMODULE_ASSIMP_ENABLED /DMODULE_BMP_ENABLED /DMODULE_BULLET_ENABLED /DMODULE_CAMERA_ENABLED /DMODULE_CSG_ENABLED /DMODULE_CVTT_ENABLED /DMODULE_DDS_ENABLED /DMODULE_ENET_ENABLED /DMODULE_ETC_ENABLED /DMODULE_FREETYPE_ENABLED /DMODULE_GDNATIVE_ENABLED /DMODULE_GDSCRIPT_ENABLED /DMODULE_GRIDMAP_ENABLED /DMODULE_HDR_ENABLED /DMODULE_JPG_ENABLED /DMODULE_JSONRPC_ENABLED /DMODULE_LUASCRIPT_ENABLED /Ithirdparty\libpng /Ithirdparty\glad /Ithirdparty\zstd /Ithirdparty\zlib /Iplatform\windows /I. /Imodules\luascript\lib\antlr4

This build is without modifications on SCsub.

With the modifications on SCSub I could compile with /std:c++17.

perbone commented 3 years ago

Ok gonna try to fix this today using your example.

perbone commented 3 years ago

Hi, Please kindly try the latest sources from master and share here if the problem have been fixed. -- Perbone

perbone commented 3 years ago

Please for further discussion refer to #22