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

Conflict with fmt #2872

Closed
maths644311798 opened this issue Aug 31, 2023 · 4 comments
Closed

Conflict with fmt #2872

maths644311798 opened this issue Aug 31, 2023 · 4 comments

Comments

@maths644311798
Copy link

#include
#include
#include "spdlog/fmt/bundled/format.h"
#include "fmt/ostream.h"

int main() {
printf("OK");
return 0;
}

This code can not be compiled. The errors are

/usr/local/include/fmt/ostream.h:158:1: error: 'FMT_EXPORT' does not name a type
158 | FMT_EXPORT template
| ^~~~~~~~~~
/usr/local/include/fmt/ostream.h:177:1: error: 'FMT_EXPORT' does not name a type
177 | FMT_EXPORT template <typename... T>
| ^~~~~~~~~~
/usr/local/include/fmt/ostream.h:186:1: error: 'FMT_EXPORT' does not name a type
186 | FMT_EXPORT
| ^~~~~~~~~~
/usr/local/include/fmt/ostream.h:194:1: error: 'FMT_EXPORT' does not name a type
194 | FMT_EXPORT template <typename... T>
| ^~~~~~~~~~
/usr/local/include/fmt/ostream.h:199:1: error: 'FMT_EXPORT' does not name a type

@tt4g
Copy link
Contributor

tt4g commented Aug 31, 2023

Since it is not an fmt bundled with spdlog, spdlog appears to be irrelevant.

@tt4g
Copy link
Contributor

tt4g commented Aug 31, 2023

Do not include headers from the same library in multiple locations.
That is your mistake.

#include "spdlog/fmt/bundled/format.h"
#include "fmt/ostream.h"

@maths644311798
Copy link
Author

What if I need to use both spdlog and fmt/ostream.h?

@tt4g
Copy link
Contributor

tt4g commented Aug 31, 2023

Use #include include/spdlog/fmt/ostr.h.

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

No branches or pull requests

2 participants