简体   繁体   中英

linking mac framework to qt creator

I have a project that uses SystemConfiguration.Framework.

I've been using xcode, where adding the framework is quite easy, just add it to xcode project's framework. But now, I need my project to be cross platform, so I'm using QT Creator as a single IDE, for Windows and Mac. The problem is that I don't know how to tell QT Creator how to link to the systemConfiguration.framework. The header from the framework are correctly included, no problem there... just when is ending the compilation it complains that some symbols where not found, ie, the symbols that are exported from the systemconfiguration.framework...

Does anyone knows or can help me to set up the Qt creator project to link agains that framework, please?

I assume the project itself is using Qt ie it is using .pro files to configure things like include paths and library/framework paths? If so then you just need to update the relevant .pro file to add the framework.

See the qmake docs for more detail. The gist of it is to add

QMAKE_LFLAGS += -F/path/to/framework/directory/

and

LIBS += -framework TheFramework

I found a solution which works with Qt 5.6 here: https://doc.qt.io/qt-5/qmake-platform-notes.html#creating-frameworks

Using Frameworks

qmake is able to automatically generate build rules for linking against frameworks in the standard framework directory on macOS, located at /Library/Frameworks/.

Directories other than the standard framework directory need to be specified to the build system, and this is achieved by appending linker options to the LIBS variable, as shown in the following example:

LIBS += -F/path/to/framework/directory/

The framework itself is linked in by appending the -framework options and the > name of the framework to the LIBS variable:

LIBS += -framework TheFramework

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM