Solved Include multiple pri files in project
-
I have two pri-files (MyQtLibrary1.pri, MyQtLibrary2.pri) with Android-specifing libraries and test project ('untitled.pro') where i include them. Everything works if i include one of them MyQtLibrary1.pri OR MyQtLibrary2.pri, if i include both project not builds, i got error
error: [libuntitled.so] Error 4
//untitled.pro: //... include (../MyQtLibrary1.pri/MyQtLibrary1.pri) include (../MyQtLibrary2.pri/MyQtLibrary2.pri)
-
Including multiple pri files is allowed and works. I suspect something else causes the error. Is there any more output printed before that error line? Do any definitions from first pri conflict with the other?
-
MyQtLibrary1.pri actually is is QtAdMobBanner.pri and MyQtLibrary2.pri is QtPlayBilling.pri, here is contents of them:
//QtAdMobBanner.pri: QT += androidextras CONFIG += c++14 HEADERS += \ $$PWD/admob_banner.hpp \ $$PWD/admob_interstitial.hpp SOURCES += \ $$PWD/admob_banner.cpp \ $$PWD/admob_interstitial.cpp OTHER_FILES += $$PWD/android/src/org/example/qtadmob/QtAdMobBanner.java \ $$PWD/android/src/org/example/qtadmob/QtAdMobInterstitial.java QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$shell_path($$PWD/android/src/org/example/qtadmob) $$shell_path($$ANDROID_PACKAGE_SOURCE_DIR/src/org/example/qtadmob)
//QtPlayBilling.pri: QT += androidextras CONFIG += c++14 HEADERS += \ $$PWD/play_billing.hpp \ $$PWD/managed_product.hpp SOURCES += \ $$PWD/play_billing.cpp \ $$PWD/managed_product.cpp OTHER_FILES += $$PWD/android/src/org/example/qtplaybilling/QtPlayBilling.java QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$shell_path($$PWD/android/src/org/example/qtplaybilling) $$shell_path($$ANDROID_PACKAGE_SOURCE_DIR/src/org/example/qtplaybilling)
-
Hm, they look quite innocent. Try changing the
QT +=
intoQT *=
(same forCONFIG
).You need to add newline in your QMAKE_POST_LINK call:
NL = $$escape_expand(\n\t) QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$shell_path($$PWD/android/src/org/example/qtadmob) $$shell_path($$ANDROID_PACKAGE_SOURCE_DIR/src/org/example/qtadmob) $$NL
without it, qmake will make a single line of all your post link calls, which is usually wrong.
Also, when you change this, make sure to run clean, run qmake and then build your app again.
-
@sierdzio thanks, added $$escape_expand(\n\t), now it builds