2014-04-20 33 views
2

Qt項目突然停止建設。所以剛剛創建了基於QDialog或實例的空項目。清潔,重建沒有幫助。Qt標準項目和示例停止建設

關鍵的錯誤日誌:

/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 
+0

它是Qt本身還是Qt之上的一些示例項目?如果是後者,你能否顯示你的代碼? – lpapp

+0

請顯示您的主要功能,您在哪裏使用此課程。 – lpapp

+0

不要將您的代碼發佈爲答案,請編輯您的問題。 – dtech

回答

1

基於這樣的事實,你的文件的工作對我罰款上的Archlinux使用Qt 5.2,我想你QDialog文件中的Qt的安裝得到了由一些偶然或「可見主要的」行動破壞。

重新安裝它乾淨,然後它應該工作。