Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Include multiple pri files in project
Forum Update on Monday, May 27th 2025

Include multiple pri files in project

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
5 Posts 2 Posters 4.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.
  • M Offline
    M Offline
    morte
    wrote on last edited by morte
    #1

    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)
    
    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      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?

      (Z(:^

      1 Reply Last reply
      3
      • M Offline
        M Offline
        morte
        wrote on last edited by morte
        #3

        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)
        
        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          Hm, they look quite innocent. Try changing the QT += into QT *= (same for CONFIG).

          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.

          (Z(:^

          1 Reply Last reply
          2
          • M Offline
            M Offline
            morte
            wrote on last edited by
            #5

            @sierdzio thanks, added $$escape_expand(\n\t), now it builds

            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