我不能构建和运行一个简单的Qt 5应用程序, [英] I cannot build and run a simple Qt 5 application,

查看:1258
本文介绍了我不能构建和运行一个简单的Qt 5应用程序,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 7上下载并安装了Qt 5.

我打开了QtCreator 2.6.1并创建了一个新的简单GUI应用程序。

I downloaded and installed Qt 5 on Windows 7.
I opened QtCreator 2.6.1 and created a new simple GUI application.

当我尝试运行它时,它说:

When I try to run it, it says:


\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtCore\qglobal.h:46:错误:
C1083:无法打开包含文件:'stddef.h':否这样的文件或
目录

"C:\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtCore\qglobal.h:46: error: C1083: Cannot open include file: ‘stddef.h’: No such file or directory"

问题是什么,如何解决?
我的编译器是: MSVC2010 32位

What is the problem and how do I solve it? My compiler is: MSVC2010 32 bit

推荐答案

google搜索得出以下结果:

A google search yielded the following:

http:// qt-project。 org / forums / viewthread / 10255

此线程注意到,当您没有安装Microsoft Platform SDK并且正在使用Visual Studio 。考虑到 stddef.h 是其中一个标准头(通常使用< cstddef> ,但是查看qtcore / global.h的源代码,它看起来确实包括为< stddef.h> )。

This thread notes that this error happens when you don't have the Microsoft Platform SDK installed and you are using Visual Studio. That would make sense considering that stddef.h is one of the standard headers (usually its included using <cstddef>, but looking at the source for qtcore/global.h it would seem that it is indeed included as <stddef.h>). So, try installing the platform SDK if it isn't already there.

如果你已经有sdk,也许没有正确配置。 此回答表示您需要按照Microsoft提供的说明这里可以正确地执行命令行构建。我认为Qt Creator可能从命令行执行编译器,这样可能会有帮助。

If you already do have the sdk, perhaps it isn't configured properly. This answer says you need to follow the instructions given by microsoft here to do command line builds properly. I think Qt Creator probably executes the compiler from the command line, so that may help.

如果仍然不工作,请尝试安装 MinGW 编译器并使用它。我看到一些参考说,它更容易编译Qt在windows下使用MinGW。

If that still doesn't work, try installing the MinGW compiler and using that. I have seen a few references saying that its easier to compile for Qt under windows using MinGW.

这篇关于我不能构建和运行一个简单的Qt 5应用程序,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆