gpt4 book ai didi

c++ - Xcode 10 更新后 CMake 找不到 stdc++11

转载 作者:行者123 更新时间:2023-11-30 02:18:12 29 4
gpt4 key购买 nike

我有一个使用 SFML 的 CMake 项目,它运行良好,但在更新到 Xcode 10 之后,找不到 CMake 寻找的所有编译器文件。

clang:警告:libstdc++ 已弃用;移动到 libc++

我不确定如何移动到不同的库源。

我尝试使用 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=libc++") 来使用标志。

它还告诉我:检查工作的 CXX 编译器:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- broken。我可以在终端中正常运行 g++/c++ 命令。我假设他们正在同一个地方寻找。

我正在尝试编译的 CMake 文件。它是 SFML 之一: SFML CMake

完整错误信息:

-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++                                                                               
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- broken

CMake Error at /Applications/CMake.app/Contents/share/cmake-3.7/Modules/CMakeTestCXXCompiler.cmake:44 (message):
The C++ compiler
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++"
is not able to compile a simple test program.

It fails with the following output:

Change Dir: /Users/DSchana/Documents/Libraries/SFML/build/CMakeFiles/CMakeTmp



Run Build Command:"/usr/bin/make" "cmTC_af3d5/fast"

/Applications/Xcode.app/Contents/Developer/usr/bin/make -f
CMakeFiles/cmTC_af3d5.dir/build.make CMakeFiles/cmTC_af3d5.dir/build

Building CXX object CMakeFiles/cmTC_af3d5.dir/testCXXCompiler.cxx.o


/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-arch x86_64 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.07.sdk
-mmacosx-version-min=10.7 -o
CMakeFiles/cmTC_af3d5.dir/testCXXCompiler.cxx.o -c
/Users/DSchana/Documents/Libraries/SFML/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx


warning: include path for stdlibc++ headers not found; pass '-std=libc++'
on the command line to use the libc++ standard library instead
[-Wstdlibcxx-not-found]

1 warning generated.

Linking CXX executable cmTC_af3d5

/Applications/CMake.app/Contents/bin/cmake -E cmake_link_script
CMakeFiles/cmTC_af3d5.dir/link.txt --verbose=1


/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-arch x86_64 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.07.sdk
-mmacosx-version-min=10.7 -Wl,-search_paths_first
-Wl,-headerpad_max_install_names
CMakeFiles/cmTC_af3d5.dir/testCXXCompiler.cxx.o -o cmTC_af3d5

clang: warning: libstdc++ is deprecated; move to libc++ with a minimum
deployment target of OS X 10.9 [-Wdeprecated]

ld: library not found for -lstdc++

clang: error: linker command failed with exit code 1 (use -v to see
invocation)

make[1]: *** [cmTC_af3d5] Error 1

make: *** [cmTC_af3d5/fast] Error 2





CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:47 (project)


-- Configuring incomplete, errors occurred!

最佳答案

好的。结果我只需要将 set(CMAKE_CXX_FLAGS "-stdlib=libc++") 添加到我的 CMakeLists.txt

关于c++ - Xcode 10 更新后 CMake 找不到 stdc++11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52502852/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com