Getting Xcode 4 to recompile Qt resources on Build?

  • I'm on the Mac using Xcode. Qt resource files are not being re-compiled when I build the Xcode project, despite the fact that the qt_preprocess.mak file (in the Xcode project's package) already contains:

    compiler_rcc_make_all: qrc_megatest.cpp
    -$(DEL_FILE) qrc_megatest.cpp
    qrc_megatest.cpp: megatest.qrc
    /Developer/Tools/Qt/rcc -name megatest megatest.qrc -o qrc_megatest.cpp

    and the Xcode project has a build step to "make" qt_preprocess.mak.

    I found however that I can get my resource to recompile by adding a specific build step as one of the Xcode project's build phases:

    rcc megatest.qrc -o qrc_megatest.cpp

    However, I have to build the project twice to get changes to the resource file to show up in the application. My guess is that this means that megatest.cpp is being compiled into object code prior to rcc rebuilding it.


    1. Why do I need to add my own build step "rcc megatest.qrc -o qrc_megatest.cpp" when the qt_preprocess.mak file seems to have code that looks like it should handle this already?

    2. How can I get resource file changes to show up after the first build, instead of requiring a second build? (I did already try moving the Build Phase both before and after the "Build Sources" build phase. No change.)


Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.