sol2: Compilation error after upgrading to VS2019 16.7
I just upgraded VS2019 from version 16.6, to 16.7, now this code causes sol to explode… 🤯
sol::table metatable;
metatable[sol::meta_function::new_index] = sol::as_function([](sol::table table, const char* name, sol::object object){});
1>...\sol\function_types_stateless.hpp(38,1): error C2653: 'traits_type': is not a class or namespace name
Using latest master commit of sol.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 21 (4 by maintainers)
Commits related to this issue
- Update Sol to version 3.2.2 This fixes a build error with Visual Studio 16.7 (see https://github.com/ThePhD/sol2/issues/1008). — committed to derceg/explorerplusplus by derceg 4 years ago
- Fixed a bug with MSVC and sol described in https://github.com/ThePhD/sol2/issues/1008 — committed to smartel99/HazelLua by smartel99 4 years ago
- Update Sol to version 3.2.2 This fixes a build error with Visual Studio 16.7 (see https://github.com/ThePhD/sol2/issues/1008). (cherry picked from commit 2052066b68d4f791ffad8508bba9b87e4636ba41) — committed to derceg/explorerplusplus by derceg 4 years ago
Seems like 16.7.2 update still doesn’t contain the fix from the preview… Can someone confirm?
I’m also seeing this, would be great to get a fix.
Workaround for those that want the code to compile but doesn’t want to edit sol2 source.
In Visual Studio installer, click modify on the Visual Studio 2019, go to “Individual Components”, search and download “MSVC v142 - VS 2019 C++ build tools (v14.26)” for your architecture, then in your projects properties go to Advanced and select “14.26.28801” in the “MSVC Toolset Version”.
It’ll use the working compiler version until the proper fix is released.
Still busted for me, yeah.
I’m doing a lot but this one’s on my radar still. I’m trying not to just say “well lol no more
noexceptI guess xD!”.But I just might have to…
Yes, this has been asserted before; it seems like we might “just” need to wait for 16.8 to go gold and then we can have our
noexceptagain.I’m pissed off that I updated to 16.7 a couple hours before seeing this issue. Anyway… I found a workaround that might help other.
I’m using the single include file and got the error at:
1>sol2-develop\single\include\sol\sol.hpp(17459,1): error C2653: 'traits_type': is not a class or namespace nameAs a workaround, I noticed that if I comment the conditional noexcept, the compilation works. Like this:
static int real_call(lua_State* L) /*noexcept(traits_type::is_noexcept)*/ {I know this is not ideal, but at least it allows me to keep working on my code while Microsoft doesn’t release an update (or I hit another problem)