2
votes

I have two projects in QtCreator, which both include two .pri files in another directory:

[common]
    * common.pri
    * database.pri
    * ...
[projects]
    [project1]
        * project1.pro
        * ...
    [project2]
        * project2.pro
        * ...

Let's concentrate on one .pro file. It contains the two includes:

COMMONPATH = ../../common

# INCLUDE COMMON FILES
!include($${COMMONPATH}/common.pri) {
    error(Failed to include common/common.pri)
}

# INCLUDE DATABASE FILES
!include($${COMMONPATH}/database.pri) {
    error(Failed to include common/database.pri)
}

After saving my .pro file, QtCreator didn't notice the two .pri files in the project manager.

After some time (and I can't remember what I did to do so) QtCreator showed one of the two .pri files as shown in the screenshot:

Project Manager

I'm now stuck since I can't tell why QtCreator doesn't show the second .pri file the same way it shows the first one, neither why it showed the first one only after some time...

I tried to replace the $${COMMONPATH} variable by its value, removed the error handling, restarted QtCreator multiple times, run qmake from the menu multiple times, ...

2
I just noticed that if I comment out every line in the second .pri file, QtCreator registered it in the Project Manager. So I guess that it can't cope with something in the file, I only have to figure out what ... I also noticed that qmake correctly included the .pri file, so the only problem is the Project Manager itself and something one can live with.leemes

2 Answers

1
votes

Ok this is weird. I just figured out why Project Manager doesn't display the second included .pri file:

The file contains an error(...) statement, which itself contains a ' character, which is correctly interpreted by qmake, but incorrectly by the Project Manager! The latter obviously interprets ' as a string enclosure token or something similar.

From common/database.pri:

!include(<anotherPriFile>) {
    error(Can't find file for inclusion!)
}

Correct version (removed '):

!include(<anotherPriFile>) {
    error(Cannot find file for inclusion!)
}

I'm using this QtCreator version:

Qt Creator 2.1.0 based on Qt 4.7.2
0
votes

Qt Creator uses another project configuration file with the extension .pro.user, move it somewhere else and then try to open the project again.