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 use Qt static or dynamic library in native iOS Xcode project?

How use Qt static or dynamic library in native iOS Xcode project?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 2 Posters 512 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.
  • A Offline
    A Offline
    achernyy
    wrote on last edited by achernyy
    #1

    Hello, everyone.
    I have static/dinamic library compiled with Qt (I will try use template static/shared lib from Qt creator) and I need integrate this library to existing Xcode project.

    Here is my Lib project

    QT += qml network xml

    TARGET = test_lib
    TEMPLATE = lib

    DEFINES += TEST_LIB_LIBRARY

    DEFINES += QT_DEPRECATED_WARNINGS

    SOURCES +=
    test_lib.cpp

    HEADERS +=
    test_lib.h
    test_lib_global.h

    unix {
    target.path = /usr/lib
    INSTALLS += target
    }
    #####################################
    test_lib.h

    #ifndef TEST_LIB_H
    #define TEST_LIB_H

    #include "test_lib_global.h"

    class TEST_LIBSHARED_EXPORT Test_lib
    {

    public:
    Test_lib();

    void testLib();
    

    };

    #endif // TEST_LIB_H

    #######################################

    test_lib.cpp

    #include "test_lib.h"
    #include <QDebug>

    Test_lib::Test_lib()
    {
    qDebug() << "Test lib started";
    }

    void Test_lib::testLib()
    {
    qDebug() << "Test lib fired";
    }

    ###############################

    Xcode version 9, Qt 5.11.1
    I will try to add:

    • Library Search Path in Xcode project (something like -L/Users/*******/Desktop/Qt/5.11.1/ios/lib)
    • Header Search Path in Xcode project (something like /Users/******/Desktop/Qt/5.11.1/ios/include)

    But when I try to compile Xcode project I had error like this

    Undefined symbols for architecture arm64:
    "QArrayData::deallocate(QArrayData*, unsigned long, unsigned long)", referenced from:
    QTypedArrayData<unsigned short>::deallocate(QArrayData*) in libtest_lib.a(test_lib.o)
    "QString::fromUtf8_helper(char const*, int)", referenced from:
    QString::fromUtf8(char const*, int) in libtest_lib.a(test_lib.o)
    "QTextStream::operator<<(char)", referenced from:
    QDebug::maybeSpace() in libtest_lib.a(test_lib.o)
    "QTextStream::operator<<(QString const&)", referenced from:
    QDebug::operator<<(char const*) in libtest_lib.a(test_lib.o)
    "QMessageLogger::debug() const", referenced from:
    Test_lib::Test_lib() in libtest_lib.a(test_lib.o)
    Test_lib::testLib() in libtest_lib.a(test_lib.o)
    "QDebug::~QDebug()", referenced from:
    Test_lib::Test_lib() in libtest_lib.a(test_lib.o)
    Test_lib::testLib() in libtest_lib.a(test_lib.o)
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    Please, can anybody help me or explain how to use Qt library in exist(native) Xcode project?????

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Did you also tell Xcode to link against your library ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      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