Closed WubiCookie closed 3 years ago
note: /std:c++20
is only supported since VS 16.11, /std:c++latest
should be used before that.
https://devblogs.microsoft.com/cppblog/msvc-cpp20-and-the-std-cpp20-switch
对呀对呀,确实需要想办法开启MSVC C++20,我的项目因为不支持高版本C++报错了。
C:\Qt\6.2.0\msvc2019_64\include\QtCore/qglobal.h(94): fatal error C1189: #error: "Qt requires a C++17 compiler, and a suitable value for __cplusplus. On MSVC, you must pass the /Zc:__cplusplus option to the compiler."
xmake will try to check and add -std:c++20
first. if -std:c++20
is not supported, it will use -std:c++latest
next.
Therefore, if -std:c++latest is added, it means that your msvc compiler version is too low and it does not support -std:c++20
This is not what I can observe. I have the latest version of VS and the flag is available, yet c++latest is still selected
can you run xmake f -c -vD
and xmake -rvD
let me see all output?
From what I see, the flag is called upon compilation but not set in the vs project configuration
PS C:\Users\Charles\Documents\work\Release\UserAlgos\relativeDopplerWriter> xmake f -c -vD
checking for platform ... windows
checking for architecture ... x64
checking for vswhere.exe ... C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe
checking for cl.exe ... C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe
checking for Microsoft Visual Studio (x64) version ... 2019
checkinfo: cannot runv(dmd.exe --version), No such file or directory
checking for dmd ... no
checkinfo: cannot runv(ldc2.exe --version), No such file or directory
checking for ldc2 ... no
checkinfo: cannot runv(gdc.exe --version), No such file or directory
checking for gdc ... no
checkinfo: cannot runv(zig.exe version), No such file or directory
checking for zig ... no
checkinfo: cannot runv(zig.exe version), No such file or directory
checking for zig ... no
checkinfo: cannot runv(unzip.exe -v), No such file or directory
checking for unzip ... no
checking for 7z ... C:\Users\Charles\xmake\winenv\bin\7z
checking for git ... ok
checkinfo: cannot runv(gzip.exe --version), No such file or directory
checking for gzip ... no
git rev-parse HEAD
finding iconeus-common from xmake ..
checking for xmake::iconeus-common ... iconeus-common 0.0
checking for link.exe ... C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\link.exe
checking for the linker (ld) ... link.exe
configure
{
customcascadepath = false
plat = windows
kind = static
cascadepath = C:/prog/IcoStudio_P_beta_0.1.3/projects/Cascade
clean = true
buildir = build
ccache = true
host = windows
ndk_stdcxx = true
vs = 2019
arch = x64
mode = release
}
PS C:\Users\Charles\Documents\work\Release\UserAlgos\relativeDopplerWriter> xmake -rvD
checking for cl.exe ... C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe
checking for the c++ compiler (cxx) ... cl.exe
checking for C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe ... ok
checking for flags (-Ox -fp:fast) ... ok
> cl.exe "-Ox" "-fp:fast" "/EHsc"
checking for flags (-std:c++20) ... ok
> cl.exe "-std:c++20" "/EHsc"
checking for flags (cl_external_includedir) ... ok
> cl.exe "-experimental:external" "-external:W0" "-external:IC:\Users\Charles\AppData\Local\.xmake\packages\i\iconeus-common\0.0\a18767614a79444580e1c1d310a9ddad\include" "/EHsc"checking for flags (-DNDEBUG) ... ok
> cl.exe "-DNDEBUG" "/EHsc"
checkinfo: cannot runv(ccache.exe --version), No such file or directory
checking for ccache ... no
[ 25%]: compiling.release relativeDopplerWriter.cpp
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX64\\x64\\cl.exe" -c /EHsc -nologo -Ox -fp:fast -std:c++20 -IC:\Users\Charles\Documents\work\Release\UserAlgos\relativeDopplerWriter -experimental:external -external:W0 -external:IC:\Users\Charles\AppData\Local\.xmake\packages\i\iconeus-common\0.0\a18767614a79444580e1c1d310a9ddad\include -experimental:external -external:W0 -external:IC:\Users\Charles\Documents\work\Release\UserAlgos\relativeDopplerWriter\xmake-packages\packages\c\cascade\windows\x64\release\include -DNDEBUG -Fobuild\.objs\relativeDopplerWriter\windows\x64\release\relativeDopplerWriter.cpp.obj relativeDopplerWriter.cpp
checking for flags (cl_sourceDependencies) ... ok
The title says it all.
/std:c++latest
is set instead of/std:c++20
when settingset_languages("c++20")
and generating a vsxmake project.