Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c++

xcode

ios

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. e.g.:

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.

like image 441
Silohoutte Avatar asked Sep 25 '13 15:09

Silohoutte


People also ask

How do I change target iOS in Xcode?

To change your deployment target, open up your project file in Xcode and check the setting under Build Settings -> Deployment(...) Check this answer to add earlier devices support.

How do I change iOS deployment target react native?

Click on pods. Select each project and target and click on build settings. Under Deployment section change the iOS Deployment Target version to anything more than 8.0 (better to try the same project version). Repeat this for every other project in your pods then run the app.

How do I change the minimum iOS version in Xcode?

Which version of Xcode are you using? Form the command line, use -mios-version-min=6.0 .


1 Answers

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.

like image 104
Guven Avatar answered Sep 21 '22 11:09

Guven