Ok so here's what i'm talking about. I upgraded from qt4.7.0 to qt4.7.3 and from msvc2008 to msvc2010 on Win7x64 and when i compiled my code i ran into a problem which i wasn't having before, namely the target application name had a VER_MAJ number appended to it (which wasn't happening in the previous setup). More than that, i started getting compilation error messages like these:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuil d.targets(990,5): warning MSB8012: TargetPath(D:\tmp\QTTest\debug\QTTest1.exe) does not match the Linker's OutputFile property value (D:\tmp\QTTest\debug\QTTest.exe). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuil d.targets(992,5): warning MSB8012: TargetName(QTTest1) does not match the Linker's OutputFile property value (QTTest). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
So i created a test project just to play around with it. Here's my .pro file:
TEMPLATE = vcapp
CONFIG += qt thread warn_on debug_and_release build_all largefile
QT += xml
INCLUDEPATH += ./GeneratedFiles
TARGET = QTTest
VERSION = 1.0.1
DEPENDPATH += .
UI_DIR += ./GeneratedFiles
RCC_DIR += ./GeneratedFiles
HEADERS += ./TestDialog.h
SOURCES += ./TestDialog.cpp \
./main.cpp
FORMS += ./TestDialog.ui
TEMPLATE = vcapp
CONFIG += qt thread warn_on debug_and_release build_all largefile
QT += xml
INCLUDEPATH += ./GeneratedFiles
TARGET = QTTest
VERSION = 1.0.1
DEPENDPATH += .
UI_DIR += ./GeneratedFiles
RCC_DIR += ./GeneratedFiles
HEADERS += ./TestDialog.h
SOURCES += ./TestDialog.cpp \
./main.cpp
FORMS += ./TestDialog.ui
To copy to clipboard, switch view to plain text mode
The main.cpp file is this:
#include <QtGui/QApplication>
#include "TestDialog.h"
int main(int argc, char *argv[])
{
TestDialog w;
w.show();
return a.exec();
}
#include <QtGui/QApplication>
#include "TestDialog.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
TestDialog w;
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
And the TestDialog.* are just an auto-generated empty dialog files.
Now, if i remove line 7 (VERSION = 1.0.1) from the .pro file everything compiles and runs fine, but with the VERSION variable present i get the errors posted above and even though it says that compilation is successful the application crashes at the start up. In the project settings TargetName is set to QTTest1 but in the Linker.OutputFile it is set to QTTest which is what causes the problem. If i manually change one of them so that they match project compiles and runs perfectly.
My question is: is it me who's doing something wrong here or is it a bug with qmake? And how do i fix it? Mind you, everything was working fine with the previous versions of qt and msvc. Ideally i would like to remove version number from the executable's name and still keep using the VERSION in .pro file, but after searching around it looks like that's impossible to do.
Does anybody have any ideas? I appreciate any help.
Bookmarks