How to compile Qt with Microsoft Visual Studio - visual-studio-2010

I created a Qt programme, I can compile it without problem manuelly with Visual Studio (using Add-In) but when I try to compile it with coding I have a problem. The problem is
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5): error MSB6006: "cmd.exe" exited with code 3. [C:\foo.vcxproj]
Done Building Project "C:\foo.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\foo.vcxproj" (default target) (1) ->
(CustomBuild target) ->
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5): error MSB6006: "cmd.exe" exited with code 3. [C:\foo.vcxproj]
0 Warning(s)
1 Error(s)
How can I solve the problem, please help me…
Error:
Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.1]
Copyright (C) Microsoft Corporation 2007. All rights reserved.
Build started 03.12.2013 11:35:49.
Project "C:\foo.vcxproj" on node 1 (default targets).
InitializeBuildStatus:
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5): error MSB6006: "cmd.exe" exited with code 3. [C:\foo.vcxproj]
Done Building Project "C:\foo.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\foo.vcxproj" (default target) (1) ->
(CustomBuild target) ->
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5): error MSB6006: "cmd.exe" exited with code 3. [C:\foo.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.14

This message:
The system cannot find the path specified.
in the current context tells me that the build program can't find moc.exe and uic.exe. You need to add C:\Qt\5.1.1\msvc2012_64\bin or whatever directory contains qmake.exe, moc.exe, uic.exe and other Qt programs to PATH by doing:
set PATH=C:\Qt\5.1.1\msvc2012_64\bin;%PATH%

Related

Error in visual studio 2012 (They were build errer)

I'm new at Visual studio 2010
When I hit "start debugging(F5)" obviously it says: "would you like to build it?"
then I push yes button and it is says:"There were build error. Would you like to continue and run the last successful build?"
then I hit yes button and it says: "Unable to start program c:\users\My computer\documents\visual studio 2010\projects\tutorial1\Debug\tutorial.exe"
here is the Output:
1>------ Build started: Project: tutorial1, Configuration: Debug Win32 ------
1>InitializeBuildStatus:
1> Touching "Debug\tutorial1.unsuccessfulbuild".
1>ClCompile:
1> All outputs are up-to-date.
1>ManifestResourceCompile:
1> All outputs are up-to-date.
1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.13
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I don't know how to solve this problem. Can anyone help me?
To Answer:
then I hit yes button and it says: "Unable to start program
c:\users\My computer\documents\visual studio
2010\projects\tutorial1\Debug\tutorial.exe"
This is the case where Visual Studio would try to launch the output of the previous build.
Visual Studio would try to launch the output of the StartUp project from the current Configuration (Debug/Release) output folder.
In your case "c:\users\My computer\documents\visual studio 2010\projects\tutorial1\Debug\tutorial.exe" that was built during the last build operation would have been deleted.
The deletion could have happened as part of Clean operation.
Note: Rebuild would run Clean and Build.
Based on the error posted:
Error 'LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt' after installing Visual Studio 2012 Release Preview

MSVC compile variations of same source code and then link them all together

Using the MSVC compiler I can do this from the command prompt
cl /c /Foout1 dispatch_example.cpp
cl /c /arch:AVX /Foout2 dispatch_example.cpp
cl instrset_detect.cpp out1.obj out2.obj
How to I make a Visual Studio project file do this? I mean so that from the command prompt I can do
msbuild foo.vcxproj
and it builds everything or so that I can build the project from the command prompt.
Looking at the online instructions what you typed in should work.
C:\Users\Mikhail\Documents\Visual Studio 2012\Projects\openMPProducerConsumer\openMPProducerConsumer>notepad fun.out
Microsoft (R) Build Engine version 4.0.30319.17929
[Microsoft .NET Framework, version 4.0.30319.18034]
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 5/13/2013 6:34:08 PM.
Project "C:\Users\Mikhail\Documents\Visual Studio 2012\Projects\openMPProducerConsumer\openMPProducerConsumer\openMPProducerConsumer.vcxproj" on node 1 (default targets).
InitializeBuildStatus:
Creating "x64\Debug\openMPProducerConsumer.unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
All outputs are up-to-date.
Link:
All outputs are up-to-date.
openMPProducerConsumer.vcxproj -> C:\Users\Mikhail\Documents\Visual Studio 2012\Projects\openMPProducerConsumer\openMPProducerConsumer\x64\Debug\openMPProducerConsumer.exe
FinalizeBuildStatus:
Deleting file "x64\Debug\openMPProducerConsumer.unsuccessfulbuild".
Touching "x64\Debug\openMPProducerConsumer.lastbuildstate".
Done Building Project "C:\Users\Mikhail\Documents\Visual Studio 2012\Projects\openMPProducerConsumer\openMPProducerConsumer\openMPProducerConsumer.vcxproj" (default targets).
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.36

USBView Compile Error

I just downloaded the USBView sample application, and I'm getting a cryptic error when compiling with Visual Studio 2010.
1>------ Rebuild All started: Project: usbview, Configuration: Win8 Debug Win32 ------
1>Build started 10/5/2012 11:58:11 AM.
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets(518,5):
error MSB8008: Specified platform toolset
(WindowsApplicationForDrivers8.0) is not installed or invalid. Please
make sure that a supported PlatformToolset value is selected.
1>
1>Build FAILED.
1> 1>Time Elapsed 00:00:00.16
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Any thoughts or ideas to resolve this would be appreciated. I'm using Windows 7, 32-bit.
I was able to resolve the problem by installing Visual Studio 2012 Express and recommended components, removing the offending line from the Microsoft.Cpp.Platform.targets file (double-clicked error message), and compiling as Release.

Compiling CUDA exampels with Visual Studio 2010 express

I am trying to set up a CUDA dev env on a Windows 7 32bit computer with Visual Studio 2010 Express.
But I keep getting the following error when I try to compile the bandwithTest project that follow with the CUDA SDK!
1>------ Build started: Project: cutil, Configuration: Release Win32 ------
2>------ Build started: Project: shrUtils, Configuration: Release Win32 ------
2>LINK : fatal error LNK1104: cannot open file 'lib\Win32\shrUtils32.lib'
1>LINK : fatal error LNK1104: cannot open file 'lib\Win32\\cutil32.dll'
3>------ Build started: Project: bandwidthTest, Configuration: Release Win32 ------
3>LINK : fatal error LNK1104: cannot open file '../../bin/win32/Release//bandwidthTest.exe'
========== Build: 0 succeeded, 3 failed, 0 up-to-date, 0 skipped ==========
Follow this guide: How to Run CUDA In Visual Studio 2010
Check my answer to this question:
cuda sdk example bandwidthTest - build failed
If they are already built then check if they are correctly listed in the additional library directories in the solution properties, linking tab.

Visual Studio 2010 new project wizard manufactured MFC Dialog program doesn't compile in Debug Mode?

I've created a new project using the Visual Studio 2010's wizard. Once VS was finished generating the project I tried building it - in release mode it worked great, but in debug mode it didn't, giving the following compiler error:
1>------ Build started: Project: MyProj, Configuration: Debug Win32 ------
1>Build started 05/10/2010 22:17:08.
1>InitializeBuildStatus:
1> Touching "Debug\MyProj.unsuccessfulbuild".
1>ClCompile:
1> All outputs are up-to-date.
1> All outputs are up-to-date.
1>ResourceCompile:
1> All outputs are up-to-date.
1>ManifestResourceCompile:
1> All outputs are up-to-date.
1>LINK : fatal error LNK1104: cannot open file 'D:\My Documents\Dev\MyProj\MyProj\Debug\MyProj.exe'
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.24
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I set the following parameters in the wizard:
MFC Application
Dialog based
Use MFC in a static library
Added the "Windows Sockets" advanced feature
I'm on a Windows 7 64bit Ultimate machine.
This seems like a minor bug in Visual Studio 2010. Once I closed the solution and reopened it, it worked fine...
This error is reproducible on my setup.

Resources