-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
g++-10 compilation error when including fmt/ostream.h #2479
Comments
Removing the header only macro seems to fix the issue (I hope header only is not mandatory). |
I need |
It is a design defect. To solve this, we need to reorganize the code. #include "fmt/core.h"
#include "fmt/ostream.h"
// this file should be the last, but it is now included in the `core.h`
#include "fmt/format-inl.h" |
A temporary fix would be https://gcc.godbolt.org/z/xn3YenGxe #include <fmt/core.h>
#include <fmt/ostream.h>
#define FMT_HEADER_ONLY
#undef FMT_FUNC
#define FMT_FUNC inline
#include <fmt/format-inl.h>
int main() {
fmt::print("Doesn't work.\n");
} |
Fixed in 20931ba. Thanks for reporting! |
Including the
fmt/ostream.h
header when usingg++-10
with-std=c++20
, stops compilation with an error.The issue doesn't exist with
clang 12
or the latestMSVC
.compiler :
g++ 10.3.0
with-std=c++20
OS :
Ubuntu 21.04
fmt :
8.0.1
The issue also exists in
fmt 8.0
.This issue doesn't exist in
fmt 7.1.3
.Working example :
The above compiled with
g++-10 -std=c++20
with no problems.Not working example, with link to godbolt : https://gcc.godbolt.org/z/7n6hPsdj8 :
Trying to compile with
g++-10 -std=c++20
:The text was updated successfully, but these errors were encountered: