Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  • Windows 8 Consumer Preview 32-bit
  • Visual Studio 11.0.50.214.1 Beta Express for Windows 8

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?

like image 655
Nathan Osman Avatar asked Feb 21 '23 06:02

Nathan Osman


2 Answers

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).

like image 89
James McNellis Avatar answered Mar 01 '23 23:03

James McNellis


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
like image 26
Wylie Coyote SG. Avatar answered Mar 01 '23 23:03

Wylie Coyote SG.