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

Fail to compile v2.0.0 with MSVC #518

Open
nniclausse opened this issue Nov 15, 2023 · 6 comments
Open

Fail to compile v2.0.0 with MSVC #518

nniclausse opened this issue Nov 15, 2023 · 6 comments

Comments

@nniclausse
Copy link

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.

@JohelEGP
Copy link
Collaborator

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

Yeah. This was mentioned in the latest talk: #451 (comment).

@mpusz
Copy link
Owner

mpusz commented Nov 15, 2023

@nniclausse, you can find the list of supported compilers at https://mpusz.github.io/mp-units/2.1/getting_started/installation_and_usage/. Unfortunately, MSVC is the worst one with C++20 support now. We submitted many bugs to MSVC teams, and we are waiting for them to be resolved so we may continue our efforts to make the project compile on it.

@nniclausse
Copy link
Author

ok, thanks for your feedback, i'll try clang on windows

@dpservis
Copy link

Hi, is MSVC still out of the list? (a list of supported compilers in the GitHub page would help).

@mpusz
Copy link
Owner

mpusz commented Mar 31, 2024

Yes, MSVC still does not properly support C++20.

The list of supported compilers is provided on the main page of our docs (https://mpusz.github.io/mp-units/2.2).

@dpservis
Copy link

dpservis commented Apr 1, 2024

Yes, MSVC still does not properly support C++20.

The list of supported compilers is provided on the main page of our docs (https://mpusz.github.io/mp-units/2.2).

Thanks a lot. It seems to me there is no way to bypass the problem, I have significant issues with the concepts that are not properly evaluated...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants