Nathan Osman
Nathan Osman

Reputation: 73165

Why am I receiving this error when I attempt to build Qt from source in Visual Studio 11 Express Beta?

I am trying to build Qt with Microsoft's 64-bit compiler. I downloaded qt-everywhere-opensource-src-4.8.0.tar.gz from the Qt downloads page and extracted it to D:\Qt. After launching the x64 Cross Tools Command Prompt, I ran the following commands:

set QTDIR=D:\Qt
set PATH=%PATH%;%QTDIR%\bin

configure.exe -debug-and-release -opensource -qt-zlib -qt-libpng -qt-libmng
 -qt-libtiff -qt-libjpeg -qt-style-windowsxp -qt-style-windowsvista
 -platform win32-msvc2010

The process went quite smoothly for a few minutes, but abruptly stopped with the following error:

...
qurl.cpp
qsettings_win.cpp
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 11.0\VC\BI
N\x86_amd64\cl.EXE"' : return code '0x2'
Stop.
Building qmake failed, return code 2

I have no clue what is causing that error or what to do about it - the error message is far less than helpful. Here is what my system looks like:


Edit: if I cd into the qmake directory and run nmake, we discover the actual error:

qfilesystemengine_win.cpp
qfsfileengine_win.cpp
D:\Qt\src\corelib\io\qfsfileengine_win.cpp(64) : fatal error C1083: Cannot open
include file: 'shlobj.h': No such file or directory
D:\Qt\src\corelib\io\qfilesystemengine_win.cpp(66) : fatal error C1083: Cannot o
pen include file: 'shlobj.h': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 11.0\VC\BI
N\x86_amd64\cl.EXE"' : return code '0x2'
Stop.

Why is shlobj.h missing?

Upvotes: 5

Views: 4451

Answers (4)

karlphillip
karlphillip

Reputation: 93410

I encountered the same error when trying to build Qt 5.3 Beta for WinRT.

I was on Windows 8.1 with VS 2013 (Professional) installed. To fix the problem I had to:

  • Download and install Windows 8.1 SDK. It will be placed at C:\Program Files (x86)\Windows Kits\8.1;
  • Use VS2013 x86 Native Tools Command Prompt, available at C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts.

Upvotes: 0

Wylie Coyote SG.
Wylie Coyote SG.

Reputation: 1029

I know this is an old question but I had this issue and the answer wasn't too helpful any more.

This missing file can be found in the windows SDKs. If they are missing you must be missing an SDK. For VS 2010 install the Windows 7.1 SDK and respectively for VS 2012 you will need the windows 8 SDK. Default file locations after install:

  • Windows 8 SDK:
  • C:\Program Files (x86)\Windows Kits\8.0\Include\um
  • WIndows 7 SDK:
  • C:\Program Files\Microsoft SDKs\Windows\v7.1\Include
  • C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include

Upvotes: 3

James McNellis
James McNellis

Reputation: 355009

The Visual Studio 11 Beta Express for Windows 8 only supports Metro style applications. It doesn't include the full SDK.

To build Qt, you'll need one of the other Visual Studio 11 Beta SKUs, which you can download from the Visual Studio website. The Ultimate SKU certainly includes <shlobj.h>, and probably any other missing headers (of course, that doesn't necessarily mean that Qt will build; it may inadvertently rely on quirks in Visual C++ 2010 or the Beta may have bugs that prevent it from building; your mileage may vary).

Upvotes: 5

JaredPar
JaredPar

Reputation: 754575

The error code 0x2 maps to ERROR_FILE_NOT_FOUND. Best guess is that one of the arguments of cl.exe is missing. Based on the output I would say that qsettings_win.cpp is not in the current path, or not present on the disk.

Upvotes: 0

Related Questions