mp-units icon indicating copy to clipboard operation
mp-units copied to clipboard

Fail to compile v2.0.0 with MSVC

Open nniclausse opened this issue 7 months ago • 9 comments

Hi

I'm trying to compile mp-units 2.0.0 on windows with Visual Studio (tried with 16 and 17), but it fails. It was working well with v0.8.0

I'm using cmake directly (i'm building a conda package of mp-units btw), and got a lot of compilers errors:

 Building Custom Rule H:/Mambaforge/conda-bld/mp-units_1699864922028/work/example/CMakeLists.txt
ClCompile:
  C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\HostX64\x64\CL.exe /c /I"%SRC_DIR%\src\core-io\include" /I"%SRC_DIR%\src\core\include" /I"%SRC_DIR%\src\systems\si\include" /I"%SRC_DIR%\src\systems
\isq\include" /I"%SRC_DIR%\src\systems\cgs\include" /I"%SRC_DIR%\src\systems\usc\include" /I"%SRC_DIR%\src\systems\international\include" /nologo /W4 /WX- /diagnostics:column /O2 /Ob2 /D _MBCS /D WIN32 /D _WINDOWS /D NDEBUG /D "CMAKE_IN
TDIR=\"Release\"" /Gm- /EHsc /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /std:c++20 /permissive- /Fo"avg_speed.dir\Release\\" /Fd"avg_speed.dir\Release\vc143.pdb" /external:W0 /Gd /TP /errorReport:queue /we4289  /externa
l:I "H:/Mambaforge/conda-bld/mp-units_1699864922028/_h_env/Library/include" /w14062 /w14242 /w14254 /w14263 /w14265 /w14266 /w14287 /w14296 /w14311 /w14545 /w14546 /w14547 /w14549 /w14555 /w14619 /w14640 /w14826 /w14905 /w14906 /w14928 
/utf-8 "%SRC_DIR%\example\avg_speed.cpp"
  avg_speed.cpp
%SRC_DIR%\src\core\include\mp-units/unit.h(410,31): error C7601: the associated constraints are not satisfied [%SRC_DIR%\build\example\avg_speed.vcxproj]
%SRC_DIR%\src\core\include\mp-units/unit.h(405,34): message : the concept 'mp_units::Unit<mp_units::scaled_unit<M{},mp_units::one>>' evaluated to false [%SRC_DIR%\build\example\avg_speed.vcxproj]
          with
          [
              M=mp_units::magnitude<mp_units::power_v<2,-2>{},mp_units::power_v<5,-2>{}>
          ]
%SRC_DIR%\src\core\include\mp-units/bits/unit_concepts.h(46,16): message : the constraint was not satisfied [%SRC_DIR%\build\example\avg_speed.vcxproj]
%SRC_DIR%\src\core\include\mp-units/unit.h(587,70): message : see reference to function template instantiation 'auto mp_units::operator *<_T0,mp_units::one>(M,const U)' being compiled [%SRC_DIR%\build\example\avg_speed.vcxproj]
          with
          [
              _T0=mp_units::magnitude<mp_units::power_v<2,-2>{},mp_units::power_v<5,-2>{}>,
              M=mp_units::magnitude<mp_units::power_v<2,-2>{},mp_units::power_v<5,-2>{}>,
              U=mp_units::one
          ]
%SRC_DIR%\src\core\include\mp-units/unit.h(587,35): error C2504: 'mp_units::named_unit<mp_units::basic_symbol_text<char,1,1>{mp_units::basic_fixed_string<char,1>{CharT37,0},mp_units::basic_fixed_string<CharT,1>{CharT37,0}},mp_units::sca
led_unit<M{},mp_units::one>{}>': base class undefined [%SRC_DIR%\build\example\avg_speed.vcxproj]
          with
          [
              CharT=char,
              M=mp_units::magnitude<mp_units::power_v<2,-2>{},mp_units::power_v<5,-2>{}>
          ]
%SRC_DIR%\src\core\include\mp-units/unit.h(588,37): error C2504: 'mp_units::named_unit<mp_units::basic_symbol_text<char,3,2>{mp_units::basic_fixed_string<char,3>{CharT226,128,176,0},mp_units::basic_fixed_string<CharT,2>{CharT37,111,0}},
mp_units::scaled_unit<M{},mp_units::one>{}>': base class undefined [%SRC_DIR%\build\example\avg_speed.vcxproj]
          with
          [
              CharT=char,
              M=mp_units::magnitude<mp_units::power_v<2,-3>{},mp_units::power_v<5,-3>{}>
          ]
%SRC_DIR%\src\core\include\mp-units/reference.h(76,73): error C2059: syntax error: '<end Parse>' [%SRC_DIR%\build\example\avg_speed.vcxproj]
%SRC_DIR%\src\core\include\mp-units/reference.h(156,2): message : see reference to class template instantiation 'mp_units::reference<Q,U>' being compiled [%SRC_DIR%\build\example\avg_speed.vcxproj]
%SRC_DIR%\src\core\include\mp-units/reference.h(76,79): error C2143: syntax error: missing ';' before '{' [%SRC_DIR%\build\example\avg_speed.vcxproj]
%SRC_DIR%\src\core\include\mp-units/reference.h(76,73): error C2143: syntax error: missing '>' before ';' [%SRC_DIR%\build\example\avg_speed.vcxproj]
...
[SKIP a lot of errors]
...
  %SRC_DIR%\src\systems\angular\include\mp-units/systems/angular/angular.h(51,23): error C2737: 'mp_units::angular::unit_symbols::deg2': constexpr object must be initialized [%SRC_DIR%\build\example\unmanned_aerial_vehicle.vcxproj]     
  %SRC_DIR%\src\core\include\mp-units/quantity_spec.h(1344,27): error C2131: expression did not evaluate to a constant [%SRC_DIR%\build\example\unmanned_aerial_vehicle.vcxproj]
  %SRC_DIR%\src\core\include\mp-units/quantity_spec.h(355,90): fatal  error C1903: unable to recover from previous error(s); stopping compilation [%SRC_DIR%\build\example\unmanned_aerial_vehicle.vcxproj]

    0 Warning(s)
    3153 Error(s)

Do you plan to support Visual studio again ? Or did i miss something ? Thanks.

nniclausse avatar Nov 15 '23 10:11 nniclausse