似乎有5个符号冲突:nothrow_t
,new
,delete
,new[]
,delete[]
[2/37] Building CXX object lib\CMakeFiles\cxx_shared.dir\__\src\algorithm.cpp.obj
FAILED: lib/CMakeFiles/cxx_shared.dir/__/src/algorithm.cpp.obj
C:\PROGRA~1\LLVM\bin\clang-cl.exe /nologo -TP -DNDEBUG -D_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH -D_ALLOW_MSC_VER_MISMATCH -D_CRTBLD -D_CRT_SECURE_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -IC:\Users\User\AppData\Roaming\libcxx-master\include -fms-compatibility-version=19.00 --target=x86_64--windows -D_LIBC_NO_VCRUNTIME -D_LIBCPP_NO_VCRUNTIME /MD /O2 /Ob2 /DNDEBUG /std:c++14 -Wall -Wextra -W -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wno-user-defined-literals -Wno-covered-switch-default -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-c++11-compat -Wno-undef -Wno-reserved-id-macro -Wno-gnu-include-next -Wno-gcc-compat -Wno-zero-as-null-pointer-constant -Wno-deprecated-dynamic-exception-spec -Wno-sign-conversion -Wno-old-style-cast -Wno-deprecated -Wno-shift-sign-overflow -Wno-double-promotion -Wno-error -EHsc /Zl /showIncludes /Folib\CMakeFiles\cxx_shared.dir\__\src\algorithm.cpp.obj /Fdlib\CMakeFiles\cxx_shared.dir\ -c C:\Users\User\AppData\Roaming\libcxx-master\src\algorithm.cpp
In file included from C:\Users\User\AppData\Roaming\libcxx-master\src\algorithm.cpp:10:
In file included from C:\Users\User\AppData\Roaming\libcxx-master\include\random:1645:
In file included from C:\Users\User\AppData\Roaming\libcxx-master\include\istream:163:
In file included from C:\Users\User\AppData\Roaming\libcxx-master\include\ostream:137:
In file included from C:\Users\User\AppData\Roaming\libcxx-master\include\ios:215:
In file included from C:\Users\User\AppData\Roaming\libcxx-master\include\__locale:23:
In file included from C:\Users\User\AppData\Roaming\libcxx-master\include\support/win32/locale_win32.h:15:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include\xlocinfo.h:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include\yvals.h:9:
In file included from C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\crtdbg.h:13:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include\vcruntime_new_debug.h:10:
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\include\vcruntime_new.h(34,16): error: redefinition of 'nothrow_t'
struct nothrow_t {
^
C:\Users\User\AppData\Roaming\libcxx-master\include\new(123,25): note: previous definition is here
struct _LIBCPP_TYPE_VIS nothrow_t {};
^
这是我的CMAKE。 (也尝试过19.20)
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM="C:/Program Files (x86)/Ninja/ninja.exe"
-DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe"
-DCMAKE_C_FLAGS="-fms-compatibility-version=19.00 --target=x86_64--windows -D_LIBC_NO_VCRUNTIME"
-DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe"
-DCMAKE_CXX_FLAGS="-fms-compatibility-version=19.00 --target=x86_64--windows -D_LIBC_NO_VCRUNTIME -D_LIBCPP_NO_VCRUNTIME"
-DCMAKE_C_LINK_EXECUTABLE="C:/Program Files/LLVM/bin/lld-link.exe"
-DCMAKE_CXX_LINK_EXECUTABLE="C:/Program Files/LLVM/bin/lld-link.exe"
-DLLVM_USE_LINKER="C:/Program Files/LLVM/bin/lld-link.exe"
-DLLVM_PATH="C:/Program Files/LLVM" -DLIBCXX_ENABLE_SHARED=YES
-DLIBCXX_ENABLE_STATIC=NO -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=YES
"C:/Users/User/AppData/Roaming/libcxx-master"
这是我的SDK
set LIB=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\lib\x64;
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64;
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\um\x64
我可以使它工作吗?向谁发送问题?
答案 0 :(得分:2)
我在VS2019中面临同样的问题。
我删除了no_runtime标志但设置了
-DCMAKE_C_LINK_EXECUTABLE="lld-link.exe -flavor link" ^
-DCMAKE_CXX_LINK_EXECUTABLE="lld-link.exe -flavor link" ^
添加了-flavor link
,它已成功链接。我没有测试异常,但是使用std::thread
编译程序并与cl
编译器运行程序。
UPD:抛出std::exception
的基本尝试捕获
UPD:完整的cmake批处理(您的路径可能有所不同!)
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM="D:/Programming/ninja-build/ninja.exe" ^
-DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER="clang-cl.exe" ^
-DCMAKE_C_FLAGS="-fms-compatibility-version=19.00 --target=x86_64--windows" ^
-DCMAKE_CXX_COMPILER="clang-cl.exe" ^
-DCMAKE_CXX_FLAGS="-fms-compatibility-version=19.00 --target=x86_64--windows " ^
-DCMAKE_C_LINK_EXECUTABLE="lld-link.exe -flavor link" ^
-DCMAKE_CXX_LINK_EXECUTABLE="lld-link.exe -flavor link" ^
-DLLVM_USE_LINKER="lld-link.exe" ^
-DLLVM_PATH="C:/Program Files/LLVM" -DLIBCXX_ENABLE_SHARED=YES ^
-DLIBCXX_ENABLE_STATIC=NO -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=YES ^
"D:\Programming\cpp_sandbox\libcxx-9.0.0.src"