You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please include the following information in your issue:
Which version of units you are using
2.3.3
Which compiler exhibited the problem (including compiler version)
VSC 2022
My earlier issue led me to investigate more and I found that the issue was related to a self-defined function, not the units library . However, upon further investigation I found that the units library has macro clashes with the target architecture (MSFS).
Background
Microsoft Flight Simulator 2020 is the latest iteration of the decades long Microsoft Flight Simulator series and an extremely diverse program with thousands of different tools and ways to conduct real-life aero simulations. MSFS recently released a variety of tools, namely building Web Assembly modules using C/C++ that can do anything from rendering displays, drawing 2d vector graphics, and calculating system inputs and outputs (e.g. battery voltage and current).
Problem
When writing these modules, we cannot use standard architecture targets like x64 and x86, but rather an Asobo developed toolset which leverages the MSFS SDK. This architecture is specifically designed to compile C/C++ to a .wasm binary rather than a common architecture, ensuring compatibility with a variety of systems as well as Xbox where the simulator is also available. I've explored other C++ unit libraries, but I am a proponent of this one despite the incompatibilities for three reasons:
Single header include
No external dependencies
optional usage of units in type declarations rather than forced literals
We'd like to guarantee type safety and strict adherence to dimensional analysis for recreating large and complex aircraft systems, but as of now I'm afraid there are no C++ libraries out there that support the C++ WASM framework published by Microsoft and Asobo.
Solution/info
Fortunately this seems to be an easily fixable problem, mostly related to the min() macro invoked on line 2065 of the header file
I've provided a screenshot of the error list below, as well as a link to download the latest version of the MSFS SDK if you'd like to try it. I will provide updates as I attempt to fix the library to support the architecture.
This smells like an issue due to <Windows.h> and/or <windef.h> defining min and max macros, which conflict with functions of the same name. If the issue is indeed the same, you'd get similar errors if you include <algorithm> or <limits>. I admittedly have not tried installing the SDK, so I can't say for sure whether that's the actual reason.
Is defining NOMINMAX before including anything that includes <windows.h> possible, or would that break something else?
Defining NOMINMAX isn't possible, as it would break the program, but I was able to get around the issue by renaming the min and max macros in Windows.h to minimum and maximum
Please include the following information in your issue:
Which version of
units
you are using2.3.3
Which compiler exhibited the problem (including compiler version)
VSC 2022
My earlier issue led me to investigate more and I found that the issue was related to a self-defined function, not the units library . However, upon further investigation I found that the units library has macro clashes with the target architecture (MSFS).
Background
Microsoft Flight Simulator 2020 is the latest iteration of the decades long Microsoft Flight Simulator series and an extremely diverse program with thousands of different tools and ways to conduct real-life aero simulations. MSFS recently released a variety of tools, namely building Web Assembly modules using C/C++ that can do anything from rendering displays, drawing 2d vector graphics, and calculating system inputs and outputs (e.g. battery voltage and current).
Problem
When writing these modules, we cannot use standard architecture targets like x64 and x86, but rather an Asobo developed toolset which leverages the MSFS SDK. This architecture is specifically designed to compile C/C++ to a .wasm binary rather than a common architecture, ensuring compatibility with a variety of systems as well as Xbox where the simulator is also available. I've explored other C++ unit libraries, but I am a proponent of this one despite the incompatibilities for three reasons:
We'd like to guarantee type safety and strict adherence to dimensional analysis for recreating large and complex aircraft systems, but as of now I'm afraid there are no C++ libraries out there that support the C++ WASM framework published by Microsoft and Asobo.
Solution/info
Fortunately this seems to be an easily fixable problem, mostly related to the min() macro invoked on line 2065 of the header file
detail::abs(nls::m_value - units::convert<UnitsRhs, Units>(rhs.m_value)) < std::numeric_limits<T>::min()
I've provided a screenshot of the error list below, as well as a link to download the latest version of the MSFS SDK if you'd like to try it. I will provide updates as I attempt to fix the library to support the architecture.
MRE:
MSFS SDK Installer
SDK Documentation
The text was updated successfully, but these errors were encountered: