NREL / ssc

SAM Simulation Core (SSC) contains the underlying performance and financial models for SAM
BSD 3-Clause "New" or "Revised" License
79 stars 85 forks source link

C++17 std::byte #1159

Closed dguittet closed 4 months ago

dguittet commented 5 months ago

After upgrading the code to C++17 for OR-Tools compatibility, an issue shows up in several of the CSP cpp files.

image

According to https://developercommunity.visualstudio.com/t/error-c2872-byte-ambiguous-symbol/93889, this happens even in cases where std::byte isn't used. And it wouldn't be used in SAM code because it was introduced in C++17.

The fix that we can apply for the SAM code for now, until it's fixed in the C++ / VS Code side of things is:

define _HAS_STD_BYTE 0

By doing so, you are effectively disabling the ‘byte’ type that was implemented in VS 2017. Again, this method will only work if you do not use any instances of ‘byte’ throughout your code

dguittet commented 5 months ago

@sjanzou Thanks, fixed the build of OR-Tools that is downloaded