简体   繁体   中英

C++ link error with Xcode 5 when changing iOS Deployment Target to iOS 7.0

I've upgraded to Xcode 5, and am able to build my project fine using existing settings.

Updating the Base SDK to 7.0 doesn't cause any problems.

But, when I change the iOS Deployment Target to iOS 7.0, I start getting link errors for standard C++ symbols. eg:

Undefined symbols for architecture armv7 std::string::empty() const", referenced from...

What I have tried:

  • Explicitly linking standard C++ libraries
  • Changing the "C++ Standard Library" setting in Xcode 5. Tried both libstdc++, libc++ and "Compiler Default"

It just isn't finding the C++ symbols if the Deployment Target is set to iOS 7.0, and it does if it is set to iOS 6.1.

It turns out that if XCode can't find any C++ files in the project, then it assumes that libstd++ is not required. So, you have to manually add a C++ file to the project (an empty .mm file would be enough).

All the credits go to this answer in this Stackoverflow thread .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM