marzer / tomlplusplus

Header-only TOML config file parser and serializer for C++17.
https://marzer.github.io/tomlplusplus/
MIT License
1.58k stars 152 forks source link

c++23 multible definition error when linking staticly with g++ #239

Open MarioKauer opened 3 weeks ago

MarioKauer commented 3 weeks ago

Environment

v3.4.0

Compiler:
g++ 13.2.0

C++ standard mode:
c++23

Target arch:
x86

Library configuration overrides:

define TOML_HEADER_ONLY 1

define TOML_FLOAT_CHARCONV 0

define TOML_INT_CHARCONV 0

Relevant compilation flags:
set(CMAKE_EXE_LINKER_FLAGS "-static") add_definitions(-DTOML_HEADER_ONLY)

Describe the bug

I'm using g++ with cmake to build and compile my project but if i include toml++ and use pharse() it throws linking error:

[build] C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../lib\libstdc++.a(tinfo.o):(.text$_ZNKSt9typeinfoeqERKS+0x0): multiple definition of `std::type_info::operator==(std::type_info const&) const'; CMakeFiles\imageManager.dir/objects.a(toml_implementation.cpp.obj):C:/msys64/ucrt64/include/c++/13.2.0/bits/charconv.h:96: first defined here

if i define TOML_FLOAT_CHARCONV 0 and TOML_INT_CHARCONV 0 ig get the same but witch this instead at the end:

C:/msys64/ucrt64/include/c++/13.2.0/typeinfo:194: first defined here

Im using it as single header and tried different combinations of TOML_HEADER_ONLY and TOML_IMPLEMENTATION but that doesn't do anything. If i use c++20 it compiles just fine but i want to use c++23. Also if i deactivate RTTI it compiles in c++23 as well but that isn't permanent solution for me.

Additional information

Sorry if i'm blind but i didn't find anything on the internet and chatGPT couldn't help me either xD.