Closed Daspien27 closed 4 years ago
Thanks for report of the error. We will try to resolve it. By now I propose two solutions:
nakama-cpp
with same C++ standard.
Open nakama-cpp\src\CMakeLists.txt, line 63 and set C++20:
target_compile_features(nakama-cpp PUBLIC cxx_std_20)
nakama-cpp
as shared library
https://github.com/heroiclabs/nakama-cpp#use-as-dynamic-library
- build
nakama-cpp
with same C++ standard. Open nakama-cpp\src\CMakeLists.txt, line 63 and set C++20:target_compile_features(nakama-cpp PUBLIC cxx_std_20)
Opting to modify CMakeLists is more in line with my goals, and I can verify the incorrect behavior resolves.
Thanks for looking into resolving this error!
Great! I think we will release static libs for C++17 and C++20 standard.
With further investigation, I can confirm it is due to misaligned language standards. By changing my project from C++latest to C++14
Nakama::opt::make_optional
aligns with thenonstd::optional_lite::optional
class.This is unfortunate that the
nakama-cpp
headers changes types depending on the language version. I think a potential fix would be to provide the two optional class interfaces in parallel (introducing astd::optional
when available) or to just commit to a more hardenedNakama::NOptional
type that could potentially allow conversions withnonstd::optional_lite::optional
orstd::optional
.Originally posted by @Daspien27 in https://github.com/heroiclabs/nakama-cpp/issues/24#issuecomment-633558997