问题
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:
“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”
What is the problem and how do I solve it? My compiler is: MSVC2010 32 bit
回答1:
A google search yielded the following:
http://qt-project.org/forums/viewthread/10255
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.
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.
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.
来源:https://stackoverflow.com/questions/14539529/i-cannot-build-and-run-a-simple-qt-5-application