2

I face the following error when trying to run a qwt example, the oscilloscope example to be exact in Visual Studio QT add in. There will be build errors, and the following lines will be shown:

1>------ Build started: Project: oscilloscope, Configuration: Debug Win32 ------
1>Build started 3/1/2014 4:57:18 PM.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(298,5): warning MSB8004: Intermediate Directory does not end with a trailing slash.  This build instance will add the slash as it is required to allow proper evaluation of the Intermediate Directory.
1>InitializeBuildStatus:
1>  Touching "Win32\Debug\oscilloscope.unsuccessfulbuild".
1>CustomBuild:
1>  Moc'ing knob.h...
1>  The syntax of the command is incorrect.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5): error MSB6006: "cmd.exe" exited with code 255.
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.05
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Do anybody have any idea why? Not sure if this problem is related, but when I open qt project from Visual Studio, the output from the "Qt Visual Studio Add in" shows:

--- (Import): Generating new project of oscilloscope.pro file
--- (qmake) : Using: c:\qt\qt5.1.1\5.1.1\msvc2010\bin\qmake
--- (qmake) : Working Directory: C:\qwt-6.1.0\examples\oscilloscope
--- (qmake) : Arguments: -tp vc "oscilloscope.pro" -o "oscilloscope.vcxproj" QMAKE_INCDIR_QT=$(QTDIR)\include QMAKE_LIBDIR=$(QTDIR)\lib QMAKE_MOC=$(QTDIR)\bin\moc.exe QMAKE_QMAKE=$(QTDIR)\bin\qmake.exe

--- (qmake) : Exit Code: 0

Could not parse QTDIR from project file oscilloscope.vcxproj.
--- (Import): Added oscilloscope.vcxproj to Solution

=== Update uic steps ===

=== 0 uic steps updated. ===


=== Update rcc steps ===

=== 0 rcc steps updated. ===

Could the "could not parse QTDIR from project file oscilloscope.vcxproj" be the cause of this problem?

All the examples are able to run in qt creator itself. This problem only occurs when I try to run in from Visual Studio.

I have already ran through the proper installation guide found on the qwt website for both qt creator and MSVC. Any idea why this problem occurs? Please help. Any advice or suggestion will be greatly appreciated.

László Papp
  • 51,870
  • 39
  • 111
  • 135
rockinfresh
  • 2,068
  • 4
  • 28
  • 46
  • 1
    You seem to have `\`, whereas you should have `\\`. Could you please try that? Here: `QMAKE_INCDIR_QT=$(QTDIR)\include QMAKE_LIBDIR=$(QTDIR)\lib QMAKE_MOC=$(QTDIR)\bin\moc.exe QMAKE_QMAKE=$(QTDIR)\bin\qmake.exe` – László Papp Jan 03 '14 at 09:16
  • @laszloPapp, I am still new to QT actually. How do I find what is the content of my QTDIR variable? The oscilloscope.vcxproj consists of alot of files. It be difficult to show you. But the main programs that make up the vcxproj can be found here: http://qwt.sourcearchive.com/documentation/6.0.0-1/dir_519899b039035d55e652fce59e071328.html – rockinfresh Jan 03 '14 at 09:21
  • Just look for the content I showed above, and change it manually for a test. Replace the back slashes with double back slashes for escaping. Does that make it work? – László Papp Jan 03 '14 at 09:21
  • where do I try the following lines you shown? through visual studio cmd? Sorry. This is relatively a new area to me. – rockinfresh Jan 03 '14 at 09:23
  • 1
    Just search for the QTDIR word in your settings or project files, and where you find the back slashes, change to double back slashes. Alternatively, please check if QTDIR is set properly. – László Papp Jan 03 '14 at 09:24
  • 1
    Please check this, too: https://bugreports.qt-project.org/browse/QTVSADDINBUG-208 – László Papp Jan 03 '14 at 09:30
  • Which version of the visual studio add-in do you use? – László Papp Jan 03 '14 at 09:35
  • Visual Studio add in 1.2.2. Hmm. QTDIR cannot be found in my project files, but the variable settings appears to be correct after a quick counter check with google search. – rockinfresh Jan 03 '14 at 09:37

4 Answers4

2

There was a bug in the Visual Studio add-in when using subdirs. Try to change this in the qwt.pro file before importing:

SUBDIRS = \ 
    src \
    textengines

to:

SUBDIRS = src textengines

Then, do the import again. You could also use a fixed version of the Visual Studio add-in.

Here you can find the corresponding issue on the Qt bug tracker:

Qt Visual Studio Add-in 1.1.0 doesn't parse QTDIR correctly in a project with SUBDIRs

László Papp
  • 51,870
  • 39
  • 111
  • 135
  • tried doing all the re-import through visual studio cmd, however now when I write qmake qwt.pro, the following lines will be shown: ASSERT: "fileName.isEmpty() || isAbsolutePath(fileName)" in file Q:\qt5_workdir\... Sigh... :( – rockinfresh Jan 03 '14 at 10:05
  • 1
    I am not sure why you would like to use qmake directly. I thought you would just import the project file into Visual Studio? – László Papp Jan 03 '14 at 10:06
  • Oh. After following your steps, importing the project file into visual studio still doesn't work, hence, I tried redoing all the steps from here again to play safe: http://qwt.sourceforge.net/qwtinstall.html... That's when I found the following lines. – rockinfresh Jan 03 '14 at 10:12
  • "does not work" does not work. Please provide more information what exactly did not work. – László Papp Jan 03 '14 at 10:16
  • The same exact same errors happened, or rather no change happen. The QTDIR still cannot be parsed and debug error still the same. – rockinfresh Jan 03 '14 at 10:23
  • 1
    I really cannot reproduce your issue, so I guess you are doing something strange, or it is me who gets things working automagically. :-) Please give a try to Qt 4 and the other visual studio add-in for a test. There is no way it does not work. If it is still not working, please strive for a self-contained example reproducing the issue. – László Papp Jan 03 '14 at 10:25
  • I found the solution. From: http://www.qtcentre.org/threads/56278-Qt5-project-in-VS2010-cannot-be-built-Error-MSB6006... I copied the example program and pasted in another folder... It now worked... and I am extremely confused on why!!! :( – rockinfresh Jan 03 '14 at 10:45
  • 1
    It seems that you did not follow the suggestion. You will need to refactor the SUBDIRS to have the entries in one line everywhere, including the examples.pro! – László Papp Jan 03 '14 at 10:50
  • Noted. Will try it again later! thanks for the help (: – rockinfresh Jan 03 '14 at 11:03
2

I solved this error by deleting this line into the qwtbuild.pri file:

CONFIG += silent

Now all the examples of qwt library are working well!

ThiefMaster
  • 310,957
  • 84
  • 592
  • 636
  • I didn't down vote. Just saw this answer only anyway. Haha. Anyway I solved it thanks to Laszlo already. But nevertheless, thank you too and a vote for helping (: Cheers! – rockinfresh Jan 20 '14 at 14:30
1

Try to delete the %40echo moc .* && in qwt.vcxproj qwt_designer_plugin.vcxproj.

After that, you should reload the projects.

I am using VS2013 Qwt6.1.2 Qt5.6.0.

0

I have the exact same problem using Visual Studio 2012, VS addin1.2.2, Qt 5.2, Qwt 6.1, when trying to compile the bode example. None of the above hints seem to help, in particular I don't see any multiline SUBDIRS in the .pro file.

Batox
  • 574
  • 1
  • 4
  • 16