Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to use Qt library with .a extension in iOS project ?
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
6 Posts 3 Posters 2.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    huydev
    wrote on last edited by huydev
    #1

    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 !

    jsulmJ timdayT 2 Replies Last reply
    0
    • H huydev

      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 !

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      H 1 Reply Last reply
      0
      • H huydev

        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 !

        timdayT Offline
        timdayT Offline
        timday
        wrote on last edited by
        #3

        @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).

        H 1 Reply Last reply
        0
        • jsulmJ jsulm

          @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?

          H Offline
          H Offline
          huydev
          wrote on last edited by huydev
          #4

          @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 !

          1 Reply Last reply
          0
          • timdayT timday

            @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).

            H Offline
            H Offline
            huydev
            wrote on last edited by huydev
            #5

            @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 !

            jsulmJ 1 Reply Last reply
            0
            • H huydev

              @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 !

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @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.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved