How to use Qt library with .a extension in iOS project ?



  • Hi !
    I have a custom Qt library file with .a extension. How to use this library in iOS project ? How to config Qt library in XCode ? I have try to add library in "Link Binary With Libraries", include header file from Qt library source code and Qt5.8.0/5.8/iOS/include but it didn't work. Please help me ! How to use Qt library in iOS project ?
    Thank you.

    Update
    This is source code of library.
    http://www.mediafire.com/file/qd2cdy1jkmkbay7/sharedLib.zip
    I want to use function add(int a, int b) in sharedlib.h of library in XCode project (Objective-C).
    This is how i did:
    I built this source code to libsharedLib.a file with iphoneos-clang Qt 5.8.0 (iOS) build setting by QTCreator. After that, i include libsharedLib.a to Link Binary With Libraries and i drag 2 file header sharedlib.h, sharedlib_global.h into XCode example project, i also set User Header Search Paths link to Qt5.8.0/5.8/ios/include path in Build Settings of XCode project. Finally, when i built XCode example project, i got these error link error image.
    So how to using Qt library in XCode project ? I was following this tutorial but it seem not work link tutorial. Thanks for your help !


  • Moderators

    @huydev said in How to use Qt library with .a extension in iOS project ?:

    but it didn't work

    Can you tell us what exactly did not work? What exact library do you mean? Is it part of Qt?



  • @huydev FWIW I simply add a LIBS += pathtolib/libmylib.a to my .pro files and the qmake-generated xcodeproj builds in xcode (8) with the library included just fine. (I don't use Creator at all).



  • @jsulm
    This is source code of library.
    http://www.mediafire.com/file/qd2cdy1jkmkbay7/sharedLib.zip
    I want to use function add(int a, int b) in sharedlib.h of library in XCode project (Objective-C).
    This is how i did:
    I built this source code to libsharedLib.a file with iphoneos-clang Qt 5.8.0 (iOS) build setting by QTCreator. After that, i include libsharedLib.a to Link Binary With Libraries and i drag 2 file header sharedlib.h, sharedlib_global.h into XCode example project, i also set User Header Search Paths link to Qt5.8.0/5.8/ios/include path in Build Settings of XCode project. Finally, when i built XCode example project, i got these error link error image.
    So how to using Qt library in XCode project ? I was following this tutorial but it seem not work link tutorial. Thanks for your help !



  • @timday
    I have tried but qmake-generated xcodeproj will automatically builds in Xcode with many configuration that i couldn't understand. But i want to manually use .a library file from scratch in XCode example project. My purpose is using Qt library for both iOS and Android project. Is there anyway simple to implement that ? Thanks for your help !


  • Moderators

    @huydev It looks like you're not linking against needed Qt libraries. Take a closer look at the linker errors you get: it tells you that all the needed Qt symbols could not be found. You need to link your app against Qt as the lib requires Qt.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.