If I try to use fmt in a MSVC project with /clr enabled, I get the following errors:
1>D:\Temp\ConsoleApplication1\fmt-7.1.3\include\fmt\format-inl.h(2017,11): error C3861: 'ctz': identifier not found
1>D:\Temp\ConsoleApplication1\fmt-7.1.3\include\fmt\format-inl.h(2045,11): error C3861: 'ctzll': identifier not found
Here is a simple example to reproduce these errors:
#define FMT_HEADER_ONLY
#include <fmt/format.h>
int main()
{
}
It seems due to _MANAGED beeing defined in /clr builds, the replacement funtions for 'clz', 'clzll', 'ctz' and 'ctzll' are never defined and missing.
|
#if FMT_MSC_VER && !defined(FMT_BUILTIN_CLZLL) && \ |
|
!defined(FMT_BUILTIN_CTZLL) && !defined(_MANAGED) |
I think the better approach here would be to remove the _MANAGED check and instead force this section to native mode, to be able to use intrinsics without warnings:
// Switch to native
#pragma managed(push,off)
// Do native stuff here
#pragma managed(pop)
// Switch back to previous mode
If I try to use fmt in a MSVC project with /clr enabled, I get the following errors:
Here is a simple example to reproduce these errors:
It seems due to _MANAGED beeing defined in /clr builds, the replacement funtions for 'clz', 'clzll', 'ctz' and 'ctzll' are never defined and missing.
fmt/include/fmt/format.h
Lines 206 to 207 in af56753
I think the better approach here would be to remove the _MANAGED check and instead force this section to native mode, to be able to use intrinsics without warnings: