Reputation: 27611
I've been happily compiling projects with 3rd party frameworks in Qt 5.0. After upgrading to Qt 5.1, the 3rd party frameworks can no longer be found by the linker.
There's a Qt bug report here, but I see that the item has been closed. At the bottom of the report a comment states: -
To build and link against a framework in /Library/Frameworks (the following should be added to the .pro file):
QMAKE_OBJECTIVE_CFLAGS += -F/Library/Frameworks
QMAKE_LFLAGS += -F/Library/Frameworks
QMAKE_LINK += -framework Foo
When I do this, it has no effect. Also, the 3rd party framework is a C++ library, so using QMAKE_OBJECTIVE_CFLAGS will not help. I tried substituting this for QMAKE_CXXFLAGS, but it still fails.
In addition, when adding QMAKE_OBJECTIVE_CFLAGS and QMAKE_LINK to the .pro file, Qt Creator doesn't highlight them as known compiler flags.
Does anyone know how to solve this problem, without reverting back to Qt 5.0?
Upvotes: 0
Views: 612
Reputation: 27611
The problem here was due to the fact that the .pro file already referenced the 3rd party library, when using Qt 5.0, like this: -
QMAKE_LFLAGS += -F /Library/Frameworks/otherlibrary.framework/
LIBS += -framework otherlibrary
I did not realise that although the QMAKE_LFLAGS included the path to the specific framework, it also needs the path to the root of the frameworks: -
QMAKE_LFLAGS += -F/Library/Frameworks
Adding that fixed the issue.
Upvotes: 0
Reputation: 811
You're a bit unclear on what exactly you're doing, and how it fails.
If you're trying to use the framework from a .cpp file, you need indeed to also set QMAKE_CXXFLAGS += -F/Library/Frameworks
, and possibly also QMAKE_CFLAGS
(the example in the bug report assumes the framework exposes Objective-C bindings. I will correct that)
Try this, and re-open the bug report with logs and ways to reproduce if it still fails.
(The missing highlight of Qt Creator is not relevant, they are both still qmake variables.)
Upvotes: 1