user3918985
user3918985

Reputation: 4409

Qt cannot open include file on Windows

I'm very new to Qt and C++. I'm following the qmake example on page 40 (Rapid Dialog Design) of C++ GUI programming with qt 4 (2nd ed) by Blanchette and Summerfield.

I'm running qt 5.5.1 on a 64-bit Windows 10. VS 2013 is installed.

I ran qmake -project and qmake gotocell.pro as in the instructions, then nmake from C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64

I got this error:

        "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\nmake.exe" -f Makefile.Release

Microsoft (R) Program Maintenance Utility Version 14.00.23026.0
Copyright (C) Microsoft Corporation.  All rights reserved.

        C:\Qt\Qt5.5.1\5.5\msvc2013_64\bin\uic.exe gotocelldialog.ui -o ui_gotocelldialog.h
        cl -c -nologo -Zc:wchar_t -FS -O2 -MD -Zc:strictStrings -GR -W3 -w34100 -w34189 -w44996 -EHsc -DUNICODE -DWIN32 -DWIN64 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -I. -I. -I..\..\..\..\Qt\Qt5.5.1\5.5\msvc2013_64\include -I..\..\..\..\Qt\Qt5.5.1\5.5\msvc2013_64\include\QtWidgets -I..\..\..\..\Qt\Qt5.5.1\5.5\msvc2013_64\include\QtGui -I..\..\..\..\Qt\Qt5.5.1\5.5\msvc2013_64\include\QtANGLE -I..\..\..\..\Qt\Qt5.5.1\5.5\msvc2013_64\include\QtCore -Irelease -I. -I..\..\..\..\Qt\Qt5.5.1\5.5\msvc2013_64\mkspecs\win32-msvc2013 -Forelease\ @C:\cygwin64\tmp\nmBC2B.tmp
main.cpp
..\..\..\..\Qt\Qt5.5.1\5.5\msvc2013_64\include\QtCore/qglobal.h(39): fatal error C1083: Cannot open include file: 'cstddef': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\nmake.exe"' : return code '0x2'
Stop.

What's happening and how do I resolve this?

Upvotes: 4

Views: 5841

Answers (1)

Sergei Tachenov
Sergei Tachenov

Reputation: 24869

It's usually a bad idea to invoke any of VS programs directly by specifying the full path. Instead, you should set up the environment using one of the VS-provided batch files. In fact, if you set up the environment using the Qt-provided batch file (which you probably also need to do), it will remind you of that:

C:\Users\alqualos>c:\Qt\Qt5.4.1\5.4\msvc2013_64\bin\qtenv2.bat

C:\Users\alqualos>echo off
Setting up environment for Qt usage...
Remember to call vcvarsall.bat to complete environment setup!
C:\Qt\Qt5.4.1\5.4\msvc2013_64>"c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"

C:\Qt\Qt5.4.1\5.4\msvc2013_64>nmake /?

Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
Copyright (C) Microsoft Corporation.  All rights reserved.

Upvotes: 5

Related Questions