Linking an objective-c lib on OS X
-
Hi,
I have a Qt gui app for OS X (macx-clang) and a third-party static lib (.a) that was made with objective-c. I don't have access to the lib source, only the headers.
I can't seem to link with this lib. Any of the lib's functions referenced from the app result in "unknown symbols for architecture x86_64". I've verified that the lib is x86_64 and that it was built with the same version of Clang that we're using. I assume the issue is that it's an obj-c lib.
I found references in the docs for including mm files but I don't have the source, only the lib and headers. What must I do in order to use the lib successfully?
Thanks!
-
Hi and welcome to devnet,
Can you show how you setup the linking to that library ?
-
Hi, it looks like you've been bitten by the "changing c++ standard library" syndrome. In OSX 10.9 Apple changed from using libstdc++ to libc++ so most likely your Qt app is built to use libc++ but that third-party static lib is older and built using libstdc++, that's why you get those errors.
Easiest I think is to tell Qt to build your app in the old way, try inserting
CXXFLAGS = -stdlib=libstdc++
in your .pro file. There are plenty of discussions of this, for example here and here -
To add to @hskoglund, how are you calling these function exactly ?
-
The syntax of Objective-C is not the same as pure C/C++ hence my question. Are you calling them correctly ?