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. Subdirs Projects targeting iOS from QtCreator 3.0.1 fail to build and run
Forum Update on Monday, May 27th 2025

Subdirs Projects targeting iOS from QtCreator 3.0.1 fail to build and run

Scheduled Pinned Locked Moved Mobile and Embedded
3 Posts 1 Posters 2.0k 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
    abortretryfailure
    wrote on last edited by
    #1

    I can build and run a simple iOS application as a single project, but I'd like to have better organization of my project files. I've decided to try and break my project up into apps and libs.

    I create a Subdirs Project from QtCreator, then I add a C++ library project and a Qt Quick Application. The projects use the Desktop, iPhone and iPhone simulator kits.

    MySubdirsProj.pro
    @
    CONFIG += ordered
    TEMPLATE = subdirs
    SUBDIRS +=
    MyStaticLib
    MyApp
    @

    MyStaticLib/MyStaticLib.pro
    @
    CONFIG += static
    QT -= gui
    TARGET = MyStaticLib
    TEMPLATE = lib
    DEFINES += MYSTATICLIB_LIBRARY
    SOURCES += mystaticlib.cpp
    HEADERS += mystaticlib.h
    mystaticlib_global.h
    @

    MyApp/MyApp.pro
    @

    Add more folders to ship with the application, here

    folder_01.source = qml/MyApp
    folder_01.target = qml
    DEPLOYMENTFOLDERS = folder_01

    Additional import path used to resolve QML modules in Creator's code model

    QML_IMPORT_PATH =

    The .cpp file which was generated for your project. Feel free to hack it.

    SOURCES += main.cpp
    LIBS += -L../MyStaticLib -lMyStaticLib

    Installation path

    target.path =

    Please do not modify the following two lines. Required for deployment.

    include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
    qtcAddDeployment()
    @

    Building and running on the desktop works perfectly. However, targeting the iPhone simulator results in many errors.

    Right clicking the parent MySubdirsProj and building results in the compile error:
    @xcodebuild: error: The directory /Users/.../Projects/build-MySubdirsProj-iphonesimulator_clang_Qt_5_2_1_for_iOS-Debug/MyApp does not contain an Xcode project.@

    I can work around this error by 'handholding' qtcreator through the build process.

    Right click the MyStaticLib, run qmake, then right click, build.

    Right click the MyApp, run qmake, then right click, build.

    Right click the MySubdirsProj, and build now works too.

    Clicking run in QtCreator (with the iPhone simulator kit selected) results in the Application Output:
    @Application path /Users/.../Projects/build-MySubdirsProj-iphonesimulator_clang_Qt_5_2_1_for_iOS-Debug/Debug-iphonesimulator/MyStaticLib.app doesn't exist!@

    Noticing that MyStaticLib is not an App, I right click the MyApp project and click run leading to this Application Output:
    @Application path /Users/.../Projects/build-MySubdirsProj-iphonesimulator_clang_Qt_5_2_1_for_iOS-Debug/Debug-iphonesimulator/MyApp.app doesn't exist!@

    The xcodeproject and the app are built--but they're beneath the 'MyApp' subdirectory instead of directly in the aforementioned directory. For example, MyApp.app is located here:
    @/Users/.../Projects/build-MySubdirsProj-iphonesimulator_clang_Qt_5_2_1_for_iOS-Debug/MyApp/Debug-iphonesimulator/MyApp.app@

    Best I can tell Subdirs Projects and iPhone kits don't mix.

    I have a few questions.

    Is there a way to make QtCreator's build and run commands work with Subdirs Projects using iphone kits? Maybe something I can do in the .pro files?

    Can I run the iphone simulator from the command line, is there a smart way to do that so I can still debug using QtCreator?

    What is the expected way to organize iOS applications? should everything just be in a single .pro file?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      abortretryfailure
      wrote on last edited by
      #2

      --

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

        Qt Creator 3.1 will fix some issues with Subdirs projects and iOS applications.
        "https://codereview.qt-project.org/#change,80503":https://codereview.qt-project.org/#change,80503

        In the mean time, I use this:
        @

        Workaround for issues with QtCreator Subdirs projects and iOS

        Copy the app bundle to the root build path

        CONFIG(debug, debug|release) {
        iphonesimulator:DESTDIR=$$OUT_PWD/../Debug-iphonesimulator
        iphoneos:DESTDIR=$$OUT_PWD/../Debug-iphoneos
        }
        CONFIG(release, debug|release) {
        iphonesimulator:DESTDIR=$$OUT_PWD/../../Release-iphonesimulator
        iphoneos:DESTDIR=$$OUT_PWD/../../Release-iphoneos
        }
        @

        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