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

Windows pascal macro strikes again #605

Closed
CrustyAuklet opened this issue Aug 22, 2024 · 2 comments
Closed

Windows pascal macro strikes again #605

CrustyAuklet opened this issue Aug 22, 2024 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@CrustyAuklet
Copy link

I am very sorry to report that in my transition to V2 I am hitting the pascal macro as reported in #459.

My embedded SDK has a "units.hpp" header where I include the mp-units code, and the only includes are:

#include <mp-units/systems/si.h>
#include <mp-units/systems/iec80000.h>
#include <cnl/fixed_point.h>

I get the macro error in the header systems/include/mp-units/systems/si/unit_symbols.h

inline constexpr auto qPa = quecto<pascal>;
inline constexpr auto rPa = ronto<pascal>;
inline constexpr auto yPa = yocto<pascal>;
inline constexpr auto zPa = zepto<pascal>;
inline constexpr auto aPa = atto<pascal>;
inline constexpr auto fPa = femto<pascal>;
inline constexpr auto pPa = pico<pascal>;
inline constexpr auto nPa = nano<pascal>;
inline constexpr auto uPa = micro<pascal>;
inline constexpr auto mPa = milli<pascal>;
inline constexpr auto cPa = centi<pascal>;
inline constexpr auto dPa = deci<pascal>;
inline constexpr auto Pa = pascal;
inline constexpr auto daPa = deca<pascal>;
inline constexpr auto hPa = hecto<pascal>;
inline constexpr auto kPa = kilo<pascal>;
inline constexpr auto MPa = mega<pascal>;
inline constexpr auto GPa = giga<pascal>;
inline constexpr auto TPa = tera<pascal>;
inline constexpr auto PPa = peta<pascal>;
inline constexpr auto EPa = exa<pascal>;
inline constexpr auto ZPa = zetta<pascal>;
inline constexpr auto YPa = yotta<pascal>;
inline constexpr auto RPa = ronna<pascal>;
inline constexpr auto QPa = quetta<pascal>;

Compiler: clang-cl-18
platform: Windows 10

@connorjak
Copy link

connorjak commented Aug 23, 2024

Related:

#undef pascal seems to be the fix to do, in user code right before including mp-units.

Though, from this search, it seems it might already be done? https://github.com/search?q=repo%3Ampusz%2Fmp-units+pascal&type=code

@CrustyAuklet
Copy link
Author

Though, from this search, it seems it might already be done? https://github.com/search?q=repo%3Ampusz%2Fmp-units+pascal&type=code

#undef pascal is in the header src/systems/include/mp-units/systems/si/units.h as a fix for #459.

But the header src/systems/include/mp-units/systems/si/unit_symbols.h also uses the name pascal and so also needs the same fix applied around the block of pascal unit symbols.

As a workaround I am un-defining pascal before including the mp-units headers, but since the fix was done in the library for the one instance it seems like the other should also be addressed in the library.

@mpusz mpusz closed this as completed in f0e19d0 Aug 25, 2024
@mpusz mpusz added this to the v2.3.0 milestone Aug 25, 2024
@mpusz mpusz added the bug Something isn't working label Aug 25, 2024
@mpusz mpusz self-assigned this Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants