Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MarioKauer opened this issue Oct 22, 2024 · 0 comments
Open

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

MarioKauer opened this issue Oct 22, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@MarioKauer
Copy link

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$ZNKSt9type_infoeqERKS+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.

@MarioKauer MarioKauer added the bug Something isn't working label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants
@marzer @MarioKauer and others