Qt的一个HelloWorld都出错,求大神解答,拜谢

来源:互联网 发布:自媒体软件教学 编辑:程序博客网 时间:2024/05/19 13:07

我没用Qt Creator,就创建了一个.cpp文件,这是代码:

#include <QApplication>

#include <QPushButton>


int main(int argc,char *argv[])
{
    QApplication app(argc,argv);
    QPushButton btn("hello world!");
btn.resize(100,30);
a.setMainWidget(&btn);
    btn.show();


    return app.exec();

}

然后

C:\Qt\HelloWorld>qmake -project


C:\Qt\HelloWorld>qmake

这两步都没出错,而且Makefile也生成了,pro文件里面我也加上了:

QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets


我装的Qt:

  • Qt 5.7.0 for Windows 64-bit (VS 2015, 918 MB)    (info)
  • vs版本:C:\Program Files (x86)\Microsoft Visual Studio 14.0
  • 但是接下来的nmake的时候就有错(错误信息我加粗了):
  • C:\Qt\HelloWorld>nmake
    Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
    Copyright (C) Microsoft Corporation.  All rights reserved.

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

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

            cl -c -nologo -Zc:wchar_t -FS -Zc:strictStrings -Zc:throwingNew -O2 -MD
    -GR -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -EHsc -DUNICODE
    -DWIN32 -DWIN64 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEB
    UG -I. -I. -I..\Qt5.7.0\5.7\msvc2015_64\include -I..\Qt5.7.0\5.7\msvc2015_64\inc
    lude\QtWidgets -I..\Qt5.7.0\5.7\msvc2015_64\include\QtGui -I..\Qt5.7.0\5.7\msvc2
    015_64\include\QtANGLE -I..\Qt5.7.0\5.7\msvc2015_64\include\QtCore -Irelease -I.
    .\Qt5.7.0\5.7\msvc2015_64\mkspecs\win32-msvc2015 -Forelease\ @C:\Users\ADMINI~1\
    AppData\Local\Temp\1\nm4550.tmp
    HelloWorld.cpp
    ..\Qt5.7.0\5.7\msvc2015_64\include\QtCore/qglobal.h(45): fatal error C1083: Cann
    ot open include file: 'cstddef': No such file or directory
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0
    \VC\bin\cl.EXE"' : return code '0x2'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0
    \VC\bin\nmake.exe"' : return code '0x2'
    Stop.


    大家帮我看看吧,谢谢了。。。。

1 0
原创粉丝点击