Results 1 to 3 of 3

Thread: qmake VERSION variable breaks my code on MSVC2010 with qt4.7.3

  1. #1
    Join Date
    Sep 2008
    Posts
    11
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Question qmake VERSION variable breaks my code on MSVC2010 with qt4.7.3

    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:

    Qt Code:
    1. TEMPLATE = vcapp
    2. CONFIG += qt thread warn_on debug_and_release build_all largefile
    3. QT += xml
    4. INCLUDEPATH += ./GeneratedFiles
    5.  
    6. TARGET = QTTest
    7. VERSION = 1.0.1
    8. DEPENDPATH += .
    9. UI_DIR += ./GeneratedFiles
    10. RCC_DIR += ./GeneratedFiles
    11.  
    12. HEADERS += ./TestDialog.h
    13. SOURCES += ./TestDialog.cpp \
    14. ./main.cpp
    15. FORMS += ./TestDialog.ui
    To copy to clipboard, switch view to plain text mode 

    The main.cpp file is this:

    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include "TestDialog.h"
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication a(argc, argv);
    7. TestDialog w;
    8. w.show();
    9. return a.exec();
    10. }
    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.

  2. #2
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: qmake VERSION variable breaks my code on MSVC2010 with qt4.7.3

    Just a suggestion: you changed two things at one step -- Qt version and compiler and that makes correcting things difficult. If (and you should) you have the old compiler on you PC, try using it with the new Qt to see which one causes the problem.

  3. #3
    Join Date
    Sep 2008
    Posts
    11
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: qmake VERSION variable breaks my code on MSVC2010 with qt4.7.3

    Good point. I just ran qmake with msvc2008 settings and compiled it with msvc2008 and everything works fine. And it works fine because the version number is NOT appended to the target file. In fact there is no separate field in msvc2008 project settings for Target Name as there is in msvc2010. So i'm still thinking it's a qmake bug.

    But i was wondering if anyone can actually replicate this error to make sure that it's not just a problem with my setup.

    P.S.: I'm attaching the project files i used to make it easier for people try to replicate this problem.
    Attached Files Attached Files
    Last edited by redoctober0; 13th June 2011 at 15:44.

Similar Threads

  1. qmake INSTALLS variable not working as expected
    By andy.fillebrown in forum Newbie
    Replies: 4
    Last Post: 9th November 2010, 16:04
  2. Packaging with the qmake INSTALLS variable
    By Mookie in forum Installation and Deployment
    Replies: 4
    Last Post: 3rd November 2010, 19:01
  3. Qmake variable
    By bunjee in forum Qt Programming
    Replies: 3
    Last Post: 29th July 2009, 14:00
  4. qmake doesn't respect QMAKESPEC variable
    By piotr.dobrogost in forum Installation and Deployment
    Replies: 5
    Last Post: 19th July 2009, 22:08
  5. qmake - how to extract number from variable
    By Vanir in forum Qt Programming
    Replies: 1
    Last Post: 12th January 2009, 18:12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.