首页| 论坛| 消息

标题:【提问】一个简单的弹出式对话框,怎么会出现这样的错误讷??
作者:macping
日期:2006-03-03 01:13
内容:

# make
g++ -c -pipe -Wall -W -O2 -march=i386 -mcpu=i686 -g -DGLX_GLXEXT_LEGACY -fno-use-cxa-atexit -fno-exceptions-DQT_NO_DEBUG -I/usr/lib/qt-3.1/mkspecs/default -I. -I/usr/lib/qt-3.1/include -I.ui/ -I.moc/ -o .obj/testform.o .ui/testform.cpp
g++-o test .obj/main.o .obj/testform.o .obj/moc_testform.o-L/usr/lib/qt-3.1/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm
.obj/testform.o(.text+0x38): In function `testForm::okSlot()':
/root/testmain/testform.ui.h:13: undefined reference to `QWidgetFactory::create(QString const&, QObject*, QWidget*, char const*)'
collect2: ld returned 1 exit status
make: *** Error 1
文字文字


#1 [XChinux 03-03 04:47]
把源代码贴出来看看
#2 [macping 03-03 05:20]
我用的是qt designer
qt3.1
下面贴我编的.cpp 和.ui.h文件
#3 [macping 03-03 05:24]
testform.ui.h
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you wish to add, delete or rename functions or slots use
** Qt Designer which will update this file, preserving your code. Create an
** init() function in place of a constructor, and a destroy() function in
** place of a destructor.
*****************************************************************************/

void testForm::okSlot()
{
QDialog *dynamicFormm = (QDialog *)
QWidgetFactory::create( "../test/dynamicform.ui" );
if ( dynamicForm->exec() ) {
// The user accepted, act accordingly
}
delete dynamicForm;
}
#4 [macping 03-03 05:25]
main.cpp
#include
#include "testform.h"

int main( int argc, char *argv[] )
{
QApplication app( argc, argv );
testForm *mainForm = new testForm;
app.setMainWidget( mainForm );
mainForm->show();
return app.exec();
}
#5 [macping 03-03 05:34]
说白了
,就是定义一个form(testform)
,包含一个按钮,点击ok按钮(利用okSlot槽和QWidgetFactory::creat)就会出现另一个form(dynamicform)
我已经把qwidgetfactory.h包含进testform中了
可是...................
班主帮帮我

<< 1 2 >> (1/2)

回复 发表
主题 版块