AnsweredAssumed Answered

compile-time error when including ArcGIS SDK into Xcode project with other c++ code

Question asked by bernese on Oct 22, 2012
Latest reply on Oct 24, 2012 by bernese
I am unable to use the ArcGIS SDK for iOS in an XCode project that uses c++ code. If I create a new project in XCode, add an empty c++ file, and then link to the ArcGIS SDK for iOS, I get a series of errors under the header "undefined symbols for architecture i386." See attached text file for the complete error log.

If I pull out the c++ class, I can proceed to write an app that leverages the ArcGIS SDK for iOS. If I pull out the SDK, I can proceed to write an app that uses some c++ code. However, I need the ArcGIS SDK and an iOS build of the OpenCV library to play nicely within the same project. Previously, I have had no issues including c++ code in my XCode projects using the rules outlined here.

Typically, I see "undefined symbol..." errors when I forget to include a library or framework needed by some code in my project. For instance, if I set up an XCode project to use the ArcGIS SDK and I forgot to include libstdc++, I get a longer list of "undefined symbols for architecture i386" errors. In fact, the errors I am currently seeing are a subset of the errors resulting from not including libstdc++.

My guess is that when LLVM compiles a project that includes c++ code, it adjusts itself in a way that breaks the ArcGIS SDK's linkage with libstdc++. Or libstdc++ gets ignored for some other c++ library that is not quite equivalent. I base this guess on the observation that the errors I am seeing are a subset of the errors I get by not including libstdc++ and the observation that when building with c++ code in the project, I see an additional -stdlib=libc++ flag in the link phase of the compile. A -lstdc++ flag is also present since I am linking to libstdc++ in order to use the ArcGIS for iOS SDK.

Am I on track? If so, can I adjust the compiler settings to get around this?

Outcomes