[Qt-interest] 'undefined reference' error for custom getter methods

Alexandre Beraud aberaud at infflux.com
Tue Sep 8 12:03:25 CEST 2009


Hi,

Where is the getType() function implemented ?

Regards,

Alex


Deepak Angeshwar a écrit :
> All,
>
> I am getting a undefined reference error when I build my project the 
> error points to one of the getter methods in my class.
> I checked the .pro fie and can confirm that header file is added under 
> HEADERS section and the cpp has been added SOURCES
>
> //setting some value and testing it in qDebud
> quoteObject->setType("Whatever");
> qDebug() << "Type:" << quoteObject->getType();
>
>
> Error while building is
>
> client.cpp:105: undefined reference to `Quote::getType() const'
>
> //quote.h
>
> #ifndef QUOTE_H
> #define QUOTE_H
>
> #include <QObject>
> class Quote : public QObject
> {
> public:
> void setType(QString type);
> void setInstrument(QString instrument);
> QString getType() const;
> QString getInstrument() const;
>
> private:
> QString Type;
> QString Instrument;
> };
>
> #endif // QUOTE_H
>
>
> //quote.cpp
>
> #include "quote.h"
>
> void Quote::setInstrument(QString instrument){
> Instrument = instrument;
> }
>
> void Quote::setType(QString type){
> Type = type;
> }
>
>
>
> Can anyone point out what i am missing
> ------------------------------------------------------------------------
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>   


-- 
Alexandre BERAUD
Ingénieur Développement

Infflux - Informatique & Flux
Tel: 01 49 57 92 00 - Fax : 01 49 57 92 01
Mail: aberaud at infflux.com
Visitez notre site :  www.infflux.com




More information about the Qt-interest-old mailing list