Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Problem when create an Object : Undefiner reference
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Problem when create an Object : Undefiner reference

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vetryaspa
    wrote on last edited by
    #1

    Hi all,

    i don't understand the problem becuse the "undefine references" error s tu approssimative for debug and in my code is all defined but:

    @
    QList<Oggetto*> InterfacciaDataModel::convertitore(QList<MeteoLocale> lista){
    QList<Oggetto*> listToReturn;

    for(int i=0; i < lista.count(); i++) {
    Oggetto oggetto(lista.at(i).property); // here there are an error: undefined reference to Oggetto::Oggetto(QHash<QString, QString>)' listToReturn.append(&oggetto); } // and here i have the same error but for destructor: undefined reference to Oggetto::~Oggetto()'

    return listToReturn;
    }
    @

    in my .h file of Oggetto i define both method:

    @
    #include <QObject>
    #include <QHash>

    class Oggetto: public QObject {

    Q_OBJECT

    public:
    Oggetto();
    Oggetto(QHash<QString, QString> param);
    virtual ~Oggetto();

    QHash<QString, QString> property;
    }
    @

    and avery one can see the definition in the .cpp file:

    @#include "Oggetto.h"

    Oggetto::Oggetto(QHash<QString, QString> param) {
    // TODO Auto-generated constructor stub
    this->property(param);
    }

    Oggetto::Oggetto(){

    }

    Oggetto::~Oggetto() {
    // TODO Auto-generated destructor stub
    }
    @

    anione know why i have this error??

    regards to all

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Try re-running qmake, and rebuilding. I think you added Q_OBJECT later on. Q_OBJECT defines some methods, the implementation of which will be auto-generated by moc. However, moc is probably not ran on your header. It is those methods that are missing, I think.

      1 Reply Last reply
      0
      • V Offline
        V Offline
        Vetryaspa
        wrote on last edited by
        #3

        sorry there is a problem... i'm develop for BB10 and i not have the option for rerun qmake... i have try to Clean project and re build but the error remaning...

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Adrien Leravat
          wrote on last edited by
          #4

          Try removing moc_* files, or removing your .h and .cpp file from project and then adding them back.

          Like Andre said, this is very likely a qmake related issue, and cleaning all you build files manually should fix it.

          Adeneo Embedded - www.adeneo-embedded.com

          1 Reply Last reply
          0
          • V Offline
            V Offline
            Vetryaspa
            wrote on last edited by
            #5

            I have solved problem deleting project and re import all class in a new object but i have see in the includ of the header:

            @HEADERS +=
            $$BASEDIR/src/DataModelEInterfaccia/Interfaccia/InterfacciaDataModel.h
            $$BASEDIR/src/DataModelEInterfaccia/Interfaccia/Oggetto.h
            $$BASEDIR/src/DataModelEInterfaccia/MeteoLocaleDataModel/MeteoLocale.h
            $$BASEDIR/src/DatabaseSQL/SQLConnector.h
            $$BASEDIR/src/HttpRequest/HttpRequestXML.h
            $$BASEDIR/src/HttpRequest/md5.h
            $$BASEDIR/src/IlMeteo.hpp
            $$BASEDIR/src/Parsing/XMLSitForeMeteoLocale.h
            $$BASEDIR/src/ScreenView/MainScreenView.h
            $$BASEDIR/src/System/OtherFunctionCacolator.h
            $$BASEDIR/src/System/SystemConfig.h@

            now are present in the iold project missing... i think that this is the problem.. Tanks to all!! :)

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              Eh, yes. Obviously. You should just list all headers in there. Saves you a lot of headaches.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved