问题
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