How use Qt static or dynamic library in native iOS Xcode project?
-
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 = libDEFINES += TEST_LIB_LIBRARY
DEFINES += QT_DEPRECATED_WARNINGS
SOURCES +=
test_lib.cppHEADERS +=
test_lib.h
test_lib_global.hunix {
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?????
-
Hi and welcome to devnet,
Did you also tell Xcode to link against your library ?