Qt创建者:"Cannot open include file: 'windows.h'"

QtCreator: "Cannot open include file: 'windows.h'"

本文关键字:windows include 创建者 Cannot open Qt file      更新时间:2023-10-16

我是Qt的新手,所以我决定从运行一些教程(从QtCreator)开始。我想从教程2"使用Qt快速组件创建Qt快速应用程序"中编译一个项目,但以以下错误消息结束:

D:SoftwareQtSDKQtCreatorbinjom.exe -nologo -j 8 -f Makefile.Release
  cl -c -nologo -Zm200 -Zc:wchar_t- -O2 -MD -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQ_COMPONENTS_SYMBIAN -DHAVE_MOBILITY -DQT_DLL -DQT_NO_DEBUG -DQT_DECLARATIVE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"......SoftwareQtSDKSimulatorQtmsvc2008includeQtCore" -I"......SoftwareQtSDKSimulatorQtmsvc2008includeQtNetwork" -I"......SoftwareQtSDKSimulatorQtmsvc2008includeQtGui" -I"......SoftwareQtSDKSimulatorQtmsvc2008includeQtDeclarative" -I"......SoftwareQtSDKSimulatorQtmsvc2008include" -I"......SoftwareQtSDKSimulatorQtMobilitymsvc2008includeQtSystemInfo" -I"d:SoftwareQtSDKSimulatorQtMobilitymsvc2008includeQtMobilitySimulator" -I"..Tut1qmlapplicationviewer" -I"......SoftwareQtSDKSimulatorQtMobilitymsvc2008include" -I"......SoftwareQtSDKSimulatorQtMobilitymsvc2008includeQtMobility" -I"......SoftwareQtSDKSimulatorQtmsvc2008includeActiveQt" -I"release" -I"..Tut1" -I"." -I"......SoftwareQtSDKSimulatorQtmsvc2008mkspecswin32-msvc2008" -Forelease @C:Users113010~1AppDataLocalTempqmlapplicationviewer.obj.2328.0.jom
 qmlapplicationviewer.cpp
 d:softwareqtsdksimulatorqtmsvc2008mkspecswin32-msvc2008../win32-msvc2005/qplatformdefs.h(67) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
 Copying application data... 
 2 File(s) copied

我有一个Visual Studio 2008 Professional。Qt Creator似乎可以很好地识别它,所以我认为这样的错误应该永远不会出现。

我还想将工具集从Microsoft Visual c++ Compiler 9.0 (x86)更改为MinGW(当单击"管理"按钮时,它也会出现在对话框中),但是组合框是无效的。

我不知道该怎么办

如果你还没有安装Windows SDK,你可能必须安装。

在Qt Creator, Tools- Options, Build&Run, Kits中,选择一个工具包并编辑其属性,将编译器从"Microsoft Windows SDK…"更改为"Microsoft Visual c++ Compiler 9.0 (x86)"