Xcode 4.2 + c++0x/libc++ cannot find iostream

a 夏天 提交于 2019-11-29 22:14:49

问题


I'm using Macbook 1g, Snow Leopard.

Few days ago i installed xcode 4.2 and made a test project for c++0x.

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?


回答1:


"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.

Be sure to make the file name suffix of the implementation file to be ".mm".

Project->Build Settings->Apple LLVM compiler 3.1-Language-> Then: C++ Language Dialect->C++11 (or whatever option) C++ Standard Library->libstdc++

And don't forget this last one! Compile Sources as->Objective-C++




回答2:


From the comments:

Oh, i found it. libc++ as standard library requires OS X Lion! (...) I changed libc++ to libstdc++ and it compiled successfully.



来源:https://stackoverflow.com/questions/6913637/xcode-4-2-c0x-libc-cannot-find-iostream

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!