5

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.

Silohoutte
  • 73
  • 6

1 Answers1

5

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.

Community
  • 1
  • 1
Guven
  • 2,280
  • 2
  • 20
  • 34
  • Adding a dummy .mm file to the project worked. This solves the problem, but if anyone knows a better workaround it would be nice to hear. – Silohoutte Oct 10 '13 at 17:51
  • Totally agree, this is still a workaround. I guess the best solution would be to have XCode working. If you find out a better solution, please share it here as well. – Guven Oct 11 '13 at 15:08
  • We just had this problem, too, and found that a .mm file alone was not enough. We had to tell Xcode (version 5) to link with the standard C++ library, too. – Randall Cook Sep 04 '14 at 21:14