我正面临着和这个人完全一样的问题:Qmake doesn't generate a header file ..except,已经说过的答案并不能解决我的问题。当我在“qmake”之后“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$
我正在使用QT5.4与GNU GCC编译器上的ubuntu 14.04。
发布于 2015-03-13 00:01:40
在Ui::GotoCellDialog ui;
中将Ui:Dialog ui;
替换为main.cpp
。
https://stackoverflow.com/questions/29022212
复制相似问题