Solved OSX Undefined symbols
-
Hi,
compiling my desktop application with Qt-5.13.2 on Catalina using native object-c code, I have this linking errors:
Undefined symbols for architecture x86_64:
"OBJC_CLASS$_NSArray", referenced from:
and others similar.Using Qt-5.14 everything is fine, but I must compile it with 5.13.2 or previous.
-
Hi,
@niqt said in OSX Undefined symbols:
NSArray
This class comes from the Foundation framework. You have to link to it.
-
Hi have it, -framework Foundation, i have the same links options for Qt5.13.2 and 14 but on the first one i have the error.
-
Strange... Can you provide a minimal code sample that triggers this ?
-
@SGaist can download my test application here https://drive.google.com/open?id=1jDG_UxpX7Qp2qBfogSrW283acGR8m1Jh It's configurated for Qt5.14 so in the .pro there are not the OBJECTIVE_SOURCES and HEADERS that are necessary for Qt5.13.2
-
You are missing
LIBS += -framework Foundation -framework AppKit
in your .pro file. -
@SGaist said in OSX Undefined symbols:
LIBS += -framework Foundation -framework AppKit
THanks, but why with Qt5.14 add ain automatic this dependecies and with Qt5.13.2 not?
-
I used a self compiled 5.14.0 and needed to add both frameworks.
In any case, it's always better to not rely on the fact that Qt (or any other library for that matter you are using) might link to a framework you want to use and thus have it in its list of dependencies. That might change at any point in time.
Be explicit, it's always better.