如何在 Xcode 8 下用 C++11 编译项目?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39521686/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 09:15:38  来源:igfitidea点击:

How to compile a project with C++11 under Xcode 8?

c++xcode

提问by Adam

This question was asked many times and I failed to replicate all of the solutions I could find. I am unable to find this setting under File->Project Settings (as some suggested). Please be very specific. If you know an answer for Xcode 7, chances are it will work for me too.

这个问题被问了很多次,我未能复制我能找到的所有解决方案。我无法在文件-> 项目设置下找到此设置(如某些人所建议的)。请非常具体。如果您知道 Xcode 7 的答案,那么它很可能也适用于我。

回答by Matt Cobb

It's the same for 7 and 8. From the Project Navigator, select the project. In the main panel, at the top left, select the target. Now the main panel should have General, Resource Tags, Build Settings, Build Phases, & Build Rules along the top. Select Build Settings, select All. Scroll down to "Apple LLVM 8.0 Language C++" and expand it. Change "C++ Language Dialect" to "C++11 [-std=c++11]".

7 和 8 相同。从 Project Navigator 中,选择项目。在主面板的左上角,选择目标。现在主面板的顶部应该有常规、资源标签、构建设置、构建阶段和构建规则。选择构建设置,选择全部。向下滚动到“Apple LLVM 8.0 Language C++”并展开它。将“C++ 语言方言”更改为“C++11 [-std=c++11]”。

回答by keaton shine

Build Settings -> Linking-> other linker flags -> add to "-lc++"

构建设置 -> 链接 -> 其他链接器标志 -> 添加到“-lc++”