[Qt-interest] 'undefined reference' error for custom getter methods
Deepak Angeshwar
angeshwar at gmail.com
Tue Sep 8 12:35:10 CEST 2009
Its so obvious, I had not added the getter methods in the class, i dont know
how I missed that ;-(
On Tue, Sep 8, 2009 at 9:57 AM, Deepak Angeshwar <angeshwar at gmail.com>wrote:
> 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
--
------
Deepak
Milton Keynes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090908/92245a64/attachment.html
More information about the Qt-interest-old
mailing list