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

SPDLOG_LEVEL_NAMES error C2131: expression did not evaluate to a constant #3287

Open
yalov opened this issue Dec 10, 2024 · 1 comment · May be fixed by #3291
Open

SPDLOG_LEVEL_NAMES error C2131: expression did not evaluate to a constant #3287

yalov opened this issue Dec 10, 2024 · 1 comment · May be fixed by #3291

Comments

@yalov
Copy link

yalov commented Dec 10, 2024

win10, MSVC, c++17, spdlog 1.15.0, no external fmt,
spdlog added as add_subdirectory(spdlog) into a project.

The #define SPDLOG_LEVEL_NAMES { "TRCE", "DBUG", "INFO", "WARN", "ERRR", "CRIT", "OFF" } in the tweakme.h

creates

spdlog\common-inl.h(19): error C2131: expression did not evaluate to a constant

Also in the common-inl.h __cplusplus evaluate to 199711L,
so probably something wrong with the cmake "/Zc:__cplusplus" option.
it is not.

as mentioned in the #3233

commenting the constexpr fixes the problem
or

#include <string_view>
using namespace std::literals;
#define SPDLOG_LEVEL_NAMES {"TRCE"sv, "DBUG"sv, "INFO"sv, "WARN"sv, "ERRR"sv, "CRIT"sv, "OFF"sv}
@tt4g
Copy link
Contributor

tt4g commented Dec 10, 2024

PR is welcome: #3233 (comment)

@yalov yalov linked a pull request Dec 11, 2024 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.

2 participants