首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >CMake在Xcode 10更新后找不到stdc++11

CMake在Xcode 10更新后找不到stdc++11
EN

Stack Overflow用户
提问于 2018-09-25 16:29:57
回答 1查看 3.1K关注 0票数 1

我有一个使用SFML的CMake项目,它工作得很好,但是在更新到Xcode 10之后,无法找到CMake查找的所有编译器文件。

clang: warning: libstdc++ is deprecated; move to libc++

我不知道如何转移到不同的lib源。

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

它还告诉我:Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- broken。我可以在终端中很好地运行g++/c++命令。我想他们是在同一地点被寻找的。

我正试图用CMake文件进行编译。它是SFML的一个:SFML CMake

完全错误消息:

代码语言:javascript
运行
复制
-- 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!
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-09-26 01:30:18

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

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52502852

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档