Results 1 to 4 of 4

Thread: Qt5 project in VS2010 cannot be built: Error MSB6006

  1. #1
    Join Date
    Sep 2013
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Qt5 project in VS2010 cannot be built: Error MSB6006

    Good evening,

    first posting... let's see how much I can do wrong!

    I've been developing a QT OpenGL application in C++, VS2010 for some time now. The below error occurred once before; back then, I managed to fix it with a backup of the project. Now, it seems to be permanent!

    When building the project in Visual Studio, the following error occurs:
    Qt Code:
    1. error MSB6006: "cmd.exe" exited with code 1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets, line 151, col 6
    To copy to clipboard, switch view to plain text mode 
    This error just came up out of the blue when I did absolutely not change anything (just building before starting to code). Google advises to change various settings, delete, reinstall... all done, solved nothing.
    The problem also occurs with newly created QT5 projects without any other content. Turning the VS log level to "diagnose" shows the following:

    Qt Code:
    1. 1> "E:\Qt\Qt5.0.2\5.0.2\msvc2010_opengl\bin\rcc.exe" -name "testproject" -no-compress "c:\TestProject\TestProject\testproject.qrc" -o .\GeneratedFiles\qrc_testproject.cpp (task ID: 16)
    2. 1> Moc'ing testproject.h... (task ID: 16)
    3. 1> moc: Cannot create .\GeneratedFiles\Debug\moc_testproject.cpp (task ID: 16)
    4. 1> Uic'ing testproject.ui... (task ID: 16)
    5. 1> Could not create output file (task ID: 16)
    6. 1> Rcc'ing testproject.qrc... (task ID: 16)
    7. 1>RCC : warning : No resources in 'c:\TestProject\TestProject\testproject.qrc'.
    8. 1> (task ID: 16)
    9. 1> Unable to open .\GeneratedFiles\qrc_testproject.cpp for writing: The system can not find the specified path. (task ID: 16)
    10. 1> (task ID: 16)
    11. 1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5): error MSB6006: "cmd.exe" exited with code 1.
    To copy to clipboard, switch view to plain text mode 
    Before that, everything seems to run just fine.

    So, the problem might be that the MOC files could not be created. The solution here did not work.

    Any help on this problem would be much appreciated! Please tell me if there's any information I could add.
    Some facts: Visual Studio 2010, Qt5.0.2, QT VS Addin 1.2.1, OS: Windows 7
    Attempted solutions: Reinstalled QT / QT Addin / VS2010 / tried VS2012. Problem occurs only in QT5 projects (not in e.g. C++ console applications).

    Thanks for any help in advance!

    Regards,
    Brokenmind

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qt5 project in VS2010 cannot be built: Error MSB6006

    It looks like you have a relative path in MOC_DIR and the current working directory is not where you think it is, i.e. it is trying to write a file in a prohibited location like the Visual Studio program directory.

  3. #3
    Join Date
    Sep 2013
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt5 project in VS2010 cannot be built: Error MSB6006

    You're right, changing the ".\GeneratedFiles\..." to an absolute path solved the above issue, but this cannot be an acceptable solution to the problem, right?
    Furthermore, the build process seems to work now, but the program crashes when attempting to run it:
    Qt Code:
    1. Debug Error!
    2.  
    3. Program: C:\TestProject\Win32\Debug\TestProject.exe
    4. Module: 5.0.2
    5. File: kernel\qguiapplication.cpp
    6. Line: 782
    7.  
    8. Failed to load platform plugin "windows". Available platforms are:
    9.  
    10. (Press Retry to debug the application)
    To copy to clipboard, switch view to plain text mode 
    Retrying gets me to "free.c" in mvscr100d.dll, where apparently some heap couldn't be freed.

    I could not locate the file qguiapplication.cpp on the whole file system... Now I can either try to figure out why the relative path in MOC_DIR is not working and why changing it to an absolute path makes the remaining program unusable, or I can try to fix the heap exception thrown in a file which does not exist. But I have no clue about both. Seriously, what's going on here?

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qt5 project in VS2010 cannot be built: Error MSB6006

    The error is telling you that the runtime environment of your process cannot find the platform plugin. The platform plugin and source file is part of Qt5.
    If you are running the program in your IDE then you have a broken installation.
    If you are running the program in a deployed environment then you have failed to deploy the necessary plugin(s).


    The relative MOC_DIR path is not inherently wrong. That path is relative to the current working directory in which qmake is run. If your IDE is running qmake with the current working directory set to somewhere that cannot be written then there is a misconfiguration of either the IDE or the project settings (e.g. a broken shadow build path).

Similar Threads

  1. compile error Qt 4.7.4 vs2010
    By hy in forum Newbie
    Replies: 1
    Last Post: 5th September 2011, 07:18
  2. Replies: 1
    Last Post: 5th April 2011, 11:58
  3. project built error
    By Mikele di Sagitter in forum Qt Programming
    Replies: 0
    Last Post: 6th January 2011, 14:32
  4. Replies: 4
    Last Post: 18th December 2010, 08:08
  5. Replies: 3
    Last Post: 11th May 2010, 04:50

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.