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

Multiply defined symbols linker error when using with compiled spdlog lib #74

Open
seanharmer opened this issue Mar 24, 2021 · 0 comments · May be fixed by #75
Open

Multiply defined symbols linker error when using with compiled spdlog lib #74

seanharmer opened this issue Mar 24, 2021 · 0 comments · May be fixed by #75

Comments

@seanharmer
Copy link

When using spdlog as a compiled library in a project, trying to use spdlog_setup will result in multiply defined symbols linker errors:

spdlog.lib(fmt.cpp.obj) : error LNK2005: "public: virtual __cdecl fmt::v6::format_error::~format_error(void)" (??1format_error@v6@fmt@@UEAA@XZ) already defined in core_application.cpp.obj

This led me to fmtlib/fmt#372 (comment) which in turn led me to look for this in spdlog_setup sources.

In conf_impl.h, changing

#ifndef FMT_HEADER_ONLY
#define FMT_HEADER_ONLY
#endif

to

#if !defined(SPDLOG_COMPILED_LIB) && !defined(FMT_HEADER_ONLY)
#define FMT_HEADER_ONLY
#endif

seems to correctly not set FMT_HEADER_ONLY and allows linking on windows.

seanharmer added a commit to seanharmer/spdlog_setup that referenced this issue Mar 24, 2021
When using spdlog_setup with a compiled spdlog library.
Fixes guangie88#74.
@seanharmer seanharmer linked a pull request Mar 24, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant