[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: linkage error with ui-based classes
From:       LiuCougar <liucougar () gmail ! com>
Date:       2005-04-18 23:59:25
Message-ID: 95580678050418165949eed91a () mail ! gmail ! com
[Download RAW message or body]

I think if you put the definition of class ImagePrepareDocSettings
into a header file, you won't have this problem.

AFAICT, if a class is a sub-class of QObject, you can not have it
defined in a cpp file: the moc won't notice it, thus won't generate
appropriate supporting codes for that class.

On 4/18/05, Andreas Pakulat <apaku@gmx.de> wrote:
> Hi,
> 
> I got back to my project today (in the meantime I switched to kde3.4 and
> kdevelop cvs, but I don't think its related to my problem). I made a
> dialog as .ui-file and then created a c++-class, which is using the .ui
> as baseclass. Now when instantiating this c++-class I get the following
> linkage error:
> 
> imageprepareview.o(.text+0x22d6): In function
> `ImagePrepareView::slotShowDocSettings()':
> /home/andreas/projects/imageprepare/src/imageprepareview.cpp:321: undefined \
> reference to `ImagePrepareDocSettings::ImagePrepareDocSettings[in-charge](QWidget*, \
> char const*, bool, unsigned)' 
> The header file of ImagePrepareDocSettings is included in this cpp-file
> and the constructor is defined aproprately:
> 
> class ImagePrepareDocSettings : public ImagePrepareDocSettingsBase
> {
> Q_OBJECT
> 
> public:
> ImagePrepareDocSettings(QWidget* parent = 0, const char*
> name = 0, bool modal = FALSE, WFlags fl = 0 );
> ..
> }
> 
> The function slotShowDocSettings() looks like this:
> 
> void ImagePrepareView::slotShowDocSettings()
> {
> ImagePrepareDocSettings* sett = new ImagePrepareDocSettings(this);
> sett->show();
> }
> 
> I tried to google for that, but the answers did not work or where not
> applicable (having a forward declaration within a class instead of
> global scope, or just reordering the files in the Makefile.am)
> 
> Anybody got any hints on this?
> 
> Andreas
> 
> --
> You will gain money by an immoral action.
> 
> > > Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
> 


-- 
"People's characters are strengthened through struggle against
difficulties; they are weakened by comfort."
- Old Chinese adage
 
> > Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic