[solved] Qt creator complains that it cannot parse .pro file, but it can still build
-
Hello,
I have a project that contains two sub-projects I am organizing with the SUBDIRS template. I can build the projects through Qt Creator and I can run run the .exe, but I cannot run the applications through Qt Creator. When I check the project page in Qt Creator, it will not allow me to make changes to the Run configuration because it cannot parse the .pro. This confuses me, as I can successfully build the project and there are no new warnings in the compile output.
-project
-project.pro
-common
--common.pri
--common source
-subproject1
--subproject1.pro
--subproject1 source
-subproject2
--subproject2.pro
--subproject2 sourceNote: both subproject1.pro and subproject2.pro use the app template.
Here are the pro and pri files:
project.pro:
@message(~~~ project.pro ~~~)TEMPLATE = subdirs
include(common/common.pri)CONFIG += ordered
SUBDIRS = Simulator
ShutterUI@common.pri:
@message(~~~ common.pri ~~~)
#Includes common configuration for all subdirectory .pro files. this will have the shared folder
QT += networkHEADERS += ../common/header.h
SOURCES += ../common/source.cpp
WARNINGS += -Wall@
@message(~~~ subproject1.pro ~~~)
TEMPLATE = app
QT += opengl
network
svg
xmlINCLUDEPATH += directory1
directory2 --! include( ../common/common.pri ) {
error( Couldn't find the common.pri file! )
}HEADERS += subproject1header.h
SOURCES += subproject1header.cpp
LIBS += -lwsock32
-lws2_32 \FORMS += ui/subproject1form--.ui \
OTHER_FILES +=
RESOURCES +=
resources--.qrc \RC_FILE = resource--.rc
static { # everything below takes effect with CONFIG += static
CONFIG += static
QTPLUGIN += qsvg qico #qpng # image formats
DEFINES += STATIC
message("~~~ static build ~~~") # this is for information, that the static build is done
mac: TARGET = $$join(TARGET,,,_static) #this adds an _static in the end, so you can seperate static build from non static build
win32: TARGET = $$join(TARGET,,,s) #this adds an s in the end, so you can seperate static build from non static build
}message(~~~ end subproject1.pro ~
)~ subproject2.pro ~~~)
@
subproject2.pro
@message(TEMPLATE = app
QT += opengl
network
svg
xmlINCLUDEPATH += directory1
directory2-! include( ../common/common.pri ) {
error( Couldn't find the common.pri file! )
}HEADERS += subproject2header.h
SOURCES += subproject2--header.cpp
LIBS += -lwsock32
-lws2_32 \FORMS += ui/subproject1form--.ui \
OTHER_FILES +=
RESOURCES +=
resources--.qrc \RC_FILE = resource--.rc
static { # everything below takes effect with CONFIG += static
CONFIG += static
QTPLUGIN += qsvg qico #qpng # image formats
DEFINES += STATIC
message("~~~ static build ~~~") # this is for information, that the static build is done
mac: TARGET = $$join(TARGET,,,_static) #this adds an _static in the end, so you can seperate static build from non static build
win32: TARGET = $$join(TARGET,,,s) #this adds an s in the end, so you can seperate static build from non static build
}message(~~~ end subproject2.pro ~~~)
@Now, I should say this originally started as two projects that both compiled and ran as expected. They share a couple of common source files, that I wanted to manage together instead of having to update both. It is for this reason that I am trying to restructure this into a SUBDIR project.
I am using Qt 4.8.2 (32 bit, commercial), Qt Creator 2.5.2 on a windows 7 machine (64 bit).
Thank you for your help.
AB
-
Well, I think I figured out what was causing my problem.
The line below was fine for building with QMake, but apparently the Qt creator project parser is a bit more stringent.
@! include( ../common/common.pri ) {
error( Couldn't find the common.pri file! )
}@I changed this to
@ include( ../common/common.pri )@Now is parses the project file just fine.