问题描述
我正在使用Macbook 1g,雪豹.
I'm using Macbook 1g, Snow Leopard.
几天前,我安装了xcode 4.2,并为c ++ 0x创建了一个测试项目.
Few days ago i installed xcode 4.2 and made a test project for c++0x.
我将LLVM 3.0设置为c ++编译器,将C ++语言方言设置为C ++ 0x,将C ++标准库设置为libc ++.
I set LLVM 3.0 as c++ compiler, C++ Language Dialect as C++0x and C++ Standard Library as libc++.
但是在构建时,发生了错误.
but when building, error occured.
"iostream" file not found
我觉得这很令人困惑.我该如何解决这个问题?
I find it most bewildering. How can I solve this problem?
推荐答案
我将libc ++更改为libstdc ++".如何?这个设置在哪里? Apple文档说:仅将构建设置中的"C ++标准库类型"设置为...".构建设置很长,我看不到要设置的地方.谢谢.
"I changed libc++ to libstdc++". How? Where is this setting? Apple documentation says "simply set "C++ Standard Library Type" in the build settings to ... " Build settings is long and I don't see the place to set. Thanks.
编辑-没有什么比小睡可以清醒头脑的了........................................................................
Edit - Nothing like a nap to clear the head.
请确保将实现文件的文件名后缀设为".mm".
Be sure to make the file name suffix of the implementation file to be ".mm".
项目->构建设置-> Apple LLVM编译器3.1-语言->然后:C ++语言方言-> C ++ 11(或其他选项)C ++标准库-> libstdc ++
Project->Build Settings->Apple LLVM compiler 3.1-Language-> Then:C++ Language Dialect->C++11 (or whatever option)C++ Standard Library->libstdc++
别忘了这最后一个!将源代码编译为-> Objective-C ++
And don't forget this last one!Compile Sources as->Objective-C++
这篇关于Xcode 4.2 + C ++ 0x/libc ++找不到iostream的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!