Qt标准项目和示例停止建设

时间:2014-04-20 15:07:06

标签: c++ qt qt-creator qtgui qdialog

Qt项目突然停止建设。因此,刚刚创建的基于QDialog或示例的空项目。清洁,重建没有帮助。

记录关键错误:

/Users/dmitrytolstov/Workspace/Qt521/5.2.1/clang_64/lib/QtWidgets.framework/Versions/5/Headers/qdialog.h:117: 
error: unknown type name 'QDialog'  
Q_DISABLE_COPY(QDialog)

/Users/dmitrytolstov/Workspace/Qt521/5.2.1/clang_64/lib/QtWidgets.framework/Versions/5/Headers/qdialog.h:117: 
error: C++ requires a type specifier for all declarations 
Q_DISABLE_COPY(QDialog)

/Users/dmitrytolstov/Workspace/Qt521/5.2.1/clang_64/lib/QtWidgets.framework/Versions/5/Headers/qdialog.h:117: 
error: unknown type name 'QDialog'

/Users/dmitrytolstov/Workspace/CC++/QtStuff/NewDiaproj/dialog.h:10: 
error: unknown class name 'QDialog'; did you mean 'Dialog'?
class Dialog : public QDialog

/Users/dmitrytolstov/Workspace/CC++/QtStuff/NewDiaproj/dialog.h:10: 
error: base class has incomplete type
class Dialog : public QDialog

/Users/dmitrytolstov/Workspace/CC++/QtStuff/NewDiaproj/main.cpp:8: 
error: no member named 'show' in 'Dialog'
w.show();

7 errors generated.
make: *** [main.o] Error 1
18:46:36: Process «/usr/bin/make» exit with code 2.

好像qdialog.h或其他东西发生了什么事。顺便说一下QMainWindow的项目工作正常。我什么都没做。试图重新打开QtCreator,重新启动计算机。 我使用Mac OS X和Qt 5.2.1

QtCreator提供的任何示例或基于QDialog的空项目。例如: 的 dialog.cpp:

#include "dialog.h"

Dialog::Dialog(QWidget *parent) :
    QDialog(parent)
{
}

Dialog::~Dialog()
{
}

dialog.h

#ifndef DIALOG_H
#define DIALOG_H

#include <QDialog>

class Dialog : public QDialog
{
    Q_OBJECT

public:
    explicit Dialog(QWidget *parent = 0);
    ~Dialog();

};

#endif // DIALOG_H

的main.cpp

#include "dialog.h"
#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Dialog w;
    w.show();

    return a.exec();
}

NewDiaproj.pro

#-------------------------------------------------
#
# Project created by QtCreator 2014-04-20T19:31:45
#
#-------------------------------------------------

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = NewDiaproj
TEMPLATE = app


SOURCES += main.cpp\
        dialog.cpp

HEADERS  += dialog.h

1 个答案:

答案 0 :(得分:1)

基于使用Qt 5.2在Archlinux上运行文件的事实,我认为Qt安装中的QDialog文件被一些偶然的或者#34; vis#34;动作。

干净地重新安装,然后就可以了。