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. LNK 2019 Error

LNK 2019 Error

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 626 Views
  • 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.
  • M Offline
    M Offline
    meikelneit
    wrote on last edited by meikelneit
    #1

    Hello again, i have a Problem with one of my classes. When i try to compile i get the LNK2019 Error and i cant find the casue.

    my class Looks like:
    #ifndef DATABLOCKLOADER_H
    #define DATABLOCKLOADER_H

    #include <QFile>
    #include <QTreeView>
    #include "TreeModel.h"
    #include "ProjectObjects/TreeItem.h"

    class DataBlockLoader
    {
    public:
    DataBlockLoader(QTreeView *p_treeView, TreeItem *p_item, TreeModel *p_model);

    void load(QFile *p_file);
    void ArrayAnlegen(QFile *p_file, QString p_ZeilenInhalt, int p_tiefe);
    void StructAnlegen(QFile *p_file, QString p_ZeilenInhalt, int p_tiefe);
    void UDTAnlegen(QString p_filePath, QString p_ZeilenInhalt, int p_Tiefe);
    

    private:

    QTreeView *m_treeView;
    TreeModel *m_model;
    TreeItem *m_parentPointer[99];
    QRegularExpression *m_Datentypen;
    

    };

    #endif // DATABLOCKLOADER_H

    I include it in another calss with:
    #include "ProjectObjects/Devices/Siemens/CPU_S71500/DataBlockLoader.h"

    and then create an object of it with:
    DataBlockLoader *Import = new DataBlockLoader(m_treeView, m_Item, m_model);

    and that is the line causing the error. Someone got an idea? Or you Need more Information of surrounding Code?

    complete Error is here:
    DataBlockView_S71500new.obj:-1: Fehler: LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __thiscall DataBlockLoader::DataBlockLoader(class QTreeView *,class TreeItem *,class TreeModel *)" (??0DataBlockLoader@@QAE@PAVQTreeView@@PAVTreeItem@@PAVTreeModel@@@Z)" in Funktion ""private: void __thiscall DataBlockView_S71500new::sl_import(void)" (?sl_import@DataBlockView_S71500new@@AAEXXZ)".

    PS:
    The constructo was missing:
    DataBlockLoader::DataBlockLoader(QTreeView *p_treeView, TreeItem *p_item, TreeModel *p_model)
    {
    m_treeView = p_treeView;
    m_model = p_model;

    m_Datentypen = new QRegularExpression;
    m_Datentypen->setPattern(("(Array|Bool|Byte|Char|Int|String|Struct)"));
    
    m_parentPointer[1] = p_item;
    

    }

    raven-worxR jsulmJ 2 Replies Last reply
    0
    • M Offline
      M Offline
      meikelneit
      wrote on last edited by
      #6

      No i said that i little bit unclear, i just meant as information for you the constructor was missing. But it is solved now. I had to delete the QT and c++ build folder, then i just cleaned, run Remake and rebuild, then it worked. My experience now says, that LNK error is not a syntax problem in 99% of all cases .

      "solved"

      1 Reply Last reply
      1
      • M meikelneit

        Hello again, i have a Problem with one of my classes. When i try to compile i get the LNK2019 Error and i cant find the casue.

        my class Looks like:
        #ifndef DATABLOCKLOADER_H
        #define DATABLOCKLOADER_H

        #include <QFile>
        #include <QTreeView>
        #include "TreeModel.h"
        #include "ProjectObjects/TreeItem.h"

        class DataBlockLoader
        {
        public:
        DataBlockLoader(QTreeView *p_treeView, TreeItem *p_item, TreeModel *p_model);

        void load(QFile *p_file);
        void ArrayAnlegen(QFile *p_file, QString p_ZeilenInhalt, int p_tiefe);
        void StructAnlegen(QFile *p_file, QString p_ZeilenInhalt, int p_tiefe);
        void UDTAnlegen(QString p_filePath, QString p_ZeilenInhalt, int p_Tiefe);
        

        private:

        QTreeView *m_treeView;
        TreeModel *m_model;
        TreeItem *m_parentPointer[99];
        QRegularExpression *m_Datentypen;
        

        };

        #endif // DATABLOCKLOADER_H

        I include it in another calss with:
        #include "ProjectObjects/Devices/Siemens/CPU_S71500/DataBlockLoader.h"

        and then create an object of it with:
        DataBlockLoader *Import = new DataBlockLoader(m_treeView, m_Item, m_model);

        and that is the line causing the error. Someone got an idea? Or you Need more Information of surrounding Code?

        complete Error is here:
        DataBlockView_S71500new.obj:-1: Fehler: LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __thiscall DataBlockLoader::DataBlockLoader(class QTreeView *,class TreeItem *,class TreeModel *)" (??0DataBlockLoader@@QAE@PAVQTreeView@@PAVTreeItem@@PAVTreeModel@@@Z)" in Funktion ""private: void __thiscall DataBlockView_S71500new::sl_import(void)" (?sl_import@DataBlockView_S71500new@@AAEXXZ)".

        PS:
        The constructo was missing:
        DataBlockLoader::DataBlockLoader(QTreeView *p_treeView, TreeItem *p_item, TreeModel *p_model)
        {
        m_treeView = p_treeView;
        m_model = p_model;

        m_Datentypen = new QRegularExpression;
        m_Datentypen->setPattern(("(Array|Bool|Byte|Char|Int|String|Struct)"));
        
        m_parentPointer[1] = p_item;
        

        }

        raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #2

        @meikelneit
        did you already do the following?

        • clean
        • rerun qmake
        • rebuild

        If yes or that doesn't solve your issue are you sure that the cpp file implementing the type is added to your .pro file?

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        2
        • M Offline
          M Offline
          meikelneit
          wrote on last edited by
          #3

          yeah i did that before.
          clean
          run Remake
          rebuild

          how can i proof if the pro file has that cpp implemented?

          1 Reply Last reply
          0
          • M Offline
            M Offline
            meikelneit
            wrote on last edited by meikelneit
            #4

            Ok i found out, but it is inside the .pro
            ProjectObjects/Devices/Siemens/CPU_S71500/DataBlockLoader.cpp and .h

            1 Reply Last reply
            0
            • M meikelneit

              Hello again, i have a Problem with one of my classes. When i try to compile i get the LNK2019 Error and i cant find the casue.

              my class Looks like:
              #ifndef DATABLOCKLOADER_H
              #define DATABLOCKLOADER_H

              #include <QFile>
              #include <QTreeView>
              #include "TreeModel.h"
              #include "ProjectObjects/TreeItem.h"

              class DataBlockLoader
              {
              public:
              DataBlockLoader(QTreeView *p_treeView, TreeItem *p_item, TreeModel *p_model);

              void load(QFile *p_file);
              void ArrayAnlegen(QFile *p_file, QString p_ZeilenInhalt, int p_tiefe);
              void StructAnlegen(QFile *p_file, QString p_ZeilenInhalt, int p_tiefe);
              void UDTAnlegen(QString p_filePath, QString p_ZeilenInhalt, int p_Tiefe);
              

              private:

              QTreeView *m_treeView;
              TreeModel *m_model;
              TreeItem *m_parentPointer[99];
              QRegularExpression *m_Datentypen;
              

              };

              #endif // DATABLOCKLOADER_H

              I include it in another calss with:
              #include "ProjectObjects/Devices/Siemens/CPU_S71500/DataBlockLoader.h"

              and then create an object of it with:
              DataBlockLoader *Import = new DataBlockLoader(m_treeView, m_Item, m_model);

              and that is the line causing the error. Someone got an idea? Or you Need more Information of surrounding Code?

              complete Error is here:
              DataBlockView_S71500new.obj:-1: Fehler: LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __thiscall DataBlockLoader::DataBlockLoader(class QTreeView *,class TreeItem *,class TreeModel *)" (??0DataBlockLoader@@QAE@PAVQTreeView@@PAVTreeItem@@PAVTreeModel@@@Z)" in Funktion ""private: void __thiscall DataBlockView_S71500new::sl_import(void)" (?sl_import@DataBlockView_S71500new@@AAEXXZ)".

              PS:
              The constructo was missing:
              DataBlockLoader::DataBlockLoader(QTreeView *p_treeView, TreeItem *p_item, TreeModel *p_model)
              {
              m_treeView = p_treeView;
              m_model = p_model;

              m_Datentypen = new QRegularExpression;
              m_Datentypen->setPattern(("(Array|Bool|Byte|Char|Int|String|Struct)"));
              
              m_parentPointer[1] = p_item;
              

              }

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by jsulm
              #5

              @meikelneit said in LNK 2019 Error:

              The constructo was missing:

              So, is it solved now?

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • M Offline
                M Offline
                meikelneit
                wrote on last edited by
                #6

                No i said that i little bit unclear, i just meant as information for you the constructor was missing. But it is solved now. I had to delete the QT and c++ build folder, then i just cleaned, run Remake and rebuild, then it worked. My experience now says, that LNK error is not a syntax problem in 99% of all cases .

                "solved"

                1 Reply Last reply
                1

                • Login

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