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. Building a Qt library for iOS
Forum Updated to NodeBB v4.3 + New Features

Building a Qt library for iOS

Scheduled Pinned Locked Moved Mobile and Embedded
5 Posts 2 Posters 2.9k Views 1 Watching
  • 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.
  • A Offline
    A Offline
    acougre
    wrote on last edited by
    #1

    Hi

    We're having trouble linking a Qt library with a simple iOS application. We can build a complete iOS application using the Qt framework. Now we would like to share a library built upon Qt with a third party developer, in charge of the iOS app interface, without sharing source code.

    Is this possible with the current version of Qt-Creator and related tools ?

    The library can be static or shared and have a C-wrapper interface if needed. It needs access to the Qt multimedia modules however.

    So far, our attempts have failed with problem linking the library with the iOS executable. Before searching more in depth for a solution, we would like to know if this is possible at all.

    Thanks in advance for any help on the subject.

    Julien

    1 Reply Last reply
    0
    • GianlucaG Offline
      GianlucaG Offline
      Gianluca
      wrote on last edited by
      #2

      Technically it's possible.
      If you don't find any solution, try to share here details of your process and errors.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        acougre
        wrote on last edited by
        #3

        I created a library project with QtCreator,

        pro file:

        @
        QT -= gui

        TARGET = mylib
        TEMPLATE = lib
        CONFIG += staticlib

        SOURCES += mylib.cpp

        HEADERS += mylib.h
        unix {
        target.path = /usr/lib
        INSTALLS += target
        }@

        header:
        @
        #ifndef MYLIB_H
        #define MYLIB_H

        class Mylib
        {
        public:
        Mylib() {}
        int integer ();
        const char* text ();
        };

        #endif@

        source:

        @
        #include "mylib.h"

        int Mylib::integer () { return 747; }

        #include <QtCore/QString>

        const char *Mylib::text()
        {
        static QString mt ("my text");
        return mt.toLatin1().constData();
        }
        @

        The compilation is OK and a "libmylib.a" file is created for iphoneos_clang_Qt_5_3.

        In XCODE I open a classic project for iPhone as "hello word". I add the static library "libmylib.a" and the header path for "mylib.h" in the project.

        After build the linker find an error:

        Undefined symbols for architecture armv7:
        "std::bad_alloc::bad_alloc()", referenced from:
        qBadAlloc() in libQt5Core.a(qglobal.o)
        QVector<QList<bool (*)(void**)> >::reallocData(int, int, QFlagsQArrayData::AllocationOption) in libQt5Core.a(qglobal.o)
        ld: symbol(s) not found for architecture armv7
        clang: error: linker command failed with exit code 1 (use -v to see invocation)

        please how to solve this trouble? Thank's

        1 Reply Last reply
        0
        • GianlucaG Offline
          GianlucaG Offline
          Gianluca
          wrote on last edited by
          #4

          It seems that libmylib.a needs an additional library to get linked that you not included into into the project using libmylib.a

          Consider that everytime you link against a static library you also need to include all other libraries that the static library needs, because the static library is just object files into an archive and hence, the linker has to resolve all symbols otherwise it fails.

          So, look at the linker options inserted by the Qt project creating the libmylib.a and try to find out what it's missing into the project using libmylib.a

          1 Reply Last reply
          0
          • A Offline
            A Offline
            acougre
            wrote on last edited by
            #5

            ok I found the solution: in "build settings" from Xcode project in "Apple LLVM 5.1 - language - C++" section in "C++ standard library" line add "libc++" option

            thank's

            1 Reply Last reply
            0

            • Login

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