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

Can't compile with C++/CLI because of inline namespace #3731

Closed
JulZimmermann opened this issue Nov 30, 2023 · 3 comments
Closed

Can't compile with C++/CLI because of inline namespace #3731

JulZimmermann opened this issue Nov 30, 2023 · 3 comments
Labels

Comments

@JulZimmermann
Copy link

#1897 fixed a problem because of which fmt didn't compile with MSVC and /clr but 1aeed2d removed the workaround.

8.0.1 seems to be the last version working with C++/CLI

When using any newer version I get

fmt\core.h(252,1): error C2049: 'fmt::v10': non-inline namespace cannot be reopened as inline

Could a workaround be added again?

Thanks!

@vitaut
Copy link
Contributor

vitaut commented Nov 30, 2023

{fmt} requires a C++ compiler reasonably compliant with the standard. There are no plans to bring this hack back but you might be able to workaround the issue in C++/CLI by overriding FMT_BEGIN_NAMESPACE / FMT_END_NAMESPACE. I also recommend reporting a bug to Microsoft.

@bj8sk
Copy link

bj8sk commented Jun 28, 2024

What I found, when a C++/CLI project was referencing another CLI assembly, that also uses fmt, I got the error.
Compiling without the referenced assembly was fine.
"reopened" makes sense in that context, somehow the referenced project export the inline namespace, it's already there and you get clash.

@bj8sk
Copy link

bj8sk commented Jun 28, 2024

If you in the referenced assembly encapsulate the fmt includes and calls within unmanaged sections, you can observe in ILSpy that those namespace are no longer exported, and the two projects builds and runs
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants