【发布时间】:2015-03-13 08:01:40
【问题描述】:
我面临与此人完全相同的问题: Qmake doesn't generate a header file ..除了已经陈述的答案不能解决我的问题。当我在“qmake -project”之后“qmake”我的项目时,它不会生成书中所述的头文件。当我按照上述两个命令“制作”项目时,它会生成一个头文件“ui_gotocell.h”(对应于我的项目目录的名称,而不是 main.cpp 中使用的“ui_gotocelldialog.h”)并终止编译出现以下错误:
g++ -c -m32 -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../Canopy32/appdata/canopy-1.4.1.1975.rh5-x86/mkspecs/linux-g++-32 -I. -I../Canopy32/appdata/canopy-1.4.1.1975.rh5-x86/include/QtCore -I../Canopy32/appdata/canopy-1.4.1.1975.rh5-x86/include/QtGui -I../Canopy32/appdata/canopy-1.4.1.1975.rh5-x86/include -I. -I. -I. -o main.o main.cpp
main.cpp: In function ‘int main(int, char**)’:
main.cpp:10:2: error: ‘GotoCellDialog’ is not a member of ‘Ui’
Ui::GotoCellDialog ui;
^
main.cpp:10:21: error: expected ‘;’ before ‘ui’
Ui::GotoCellDialog ui;
^
main.cpp:12:2: error: ‘ui’ was not declared in this scope
ui.setupUi(dialog);
^
make: *** [main.o] Error 1
itqan@Itqan:~/gotocell$
我在 ubuntu 14.04 上使用 Qt 5.4 和 GNU GCC 编译器。
【问题讨论】: