Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. LNK2019 errors dealing with QDomNode
Qt 6.12 LTS is out! See what's new in the release blog

LNK2019 errors dealing with QDomNode

Scheduled Pinned Locked Moved Qt Creator and other tools
6 Posts 2 Posters 5.6k 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.
  • M Offline
    M Offline
    MichelleK
    wrote on last edited by
    #1

    I am new to QT. Any help would be greatly appreciated. The program was working until I added the code below into the cpp. file. I have not done anything with DOM before, which seems to be the issue. I am getting generally the same error 16 times. which is:

    mainwindow.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QDomNode::QDomNode(void)" (_imp??0QDomNode@@QEAA@XZ) referenced in function "private: void __cdecl MainWindow::on_cboPart_activated(class QString const &)" (?on_cboPart_activated@MainWindow@@AEAAXAEBVQString@@@Z)

    The .pro file is as follows:

    @
    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = CreatorExperiment
    TEMPLATE = app

    SOURCES += main.cpp
    mainwindow.cpp

    HEADERS += mainwindow.h

    FORMS += mainwindow.ui
    @

    The .h file is

    @
    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    #include <QMainWindow>
    #include "QStandardItemModel"
    #include <QXmlStreamReader>
    #include <QtXml\QDomDocument>

    namespace Ui {
    class MainWindow;
    }

    class MainWindow : public QMainWindow
    {
    Q_OBJECT

    public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    private slots:

    void on_cboJob_activated(const QString &arg1);
    
    void on_cboPart_activated(const QString &arg1);
    
    void on_cboLaserGroup_activated(const QString &arg1);
    
    void on_cboLaserGroup_currentTextChanged(const QString &arg1);
    

    private:
    Ui::MainWindow ui;
    void SetupJobDropdown();
    void SetupLaserTable();
    void SetupStatusTables();
    void ReadChildNodes(QDomNode childPlyNode, QStandardItem
    thePlyModel);
    };

    #endif // MAINWINDOW_H
    @

    and the part of the .cpp file that is causing the errors is:

    @
    void MainWindow::on_cboPart_activated(const QString &arg1)
    {
    QString FullJobAddress = "c:/qt experiments/database from laser machine/parts/E_SIZE_CDS.xml";
    QFile file(FullJobAddress);
    bool open = file.open(QIODevice::ReadOnly | QIODevice::Text);
    /* QDomDocument takes any QIODevice. as well as QString buffer*/
    QDomDocument doc; //("mydocument");
    if (!doc.setContent(&file))
    {
    return;
    }

     QStandardItem *thePart = partModel->invisibleRootItem();
    //Get the root element
    QDomElement root = doc.documentElement();
    QDomNode node;
    node = root.firstChild();
    if (!node.isNull()) {
        if (node.isElement() && node.nodeName() == "PART") {
            thePart = new QStandardItem(node.toElement().attribute("NAME"));
            partModel->appendRow(thePart);
        }
    } else {
        return;
    }
    

    QDomNode plyNode = node.firstChild();
    while (!plyNode.isNull()){
    if ( plyNode.isElement() && plyNode.nodeName() == "PLY" ) {
    QStandardItem* thePly = new QStandardItem(node.toElement().attribute("NAME"));
    thePart->appendRow(thePly);
    QDomNode childPlyNode = plyNode.firstChild();
    if (!childPlyNode.isNull()) {
    ReadChildNodes(childPlyNode, thePly);
    }
    }
    plyNode.nextSibling();
    }

    ui->treeView->setModel(partModel);
    

    }

    void MainWindow::ReadChildNodes(QDomNode childPlyNode, QStandardItem* theParentPly)
    {
    while (!childPlyNode.isNull()){
    if ( childPlyNode.isElement() && childPlyNode.nodeName() == "PLY" ) {
    QStandardItem* theChildPly = new QStandardItem(childPlyNode.toElement().attribute("NAME"));
    theParentPly->appendRow(theChildPly);
    QDomNode childPlyNode2 = childPlyNode.firstChild();
    if (!childPlyNode2.isNull()) {
    ReadChildNodes(childPlyNode2, theChildPly);
    }
    }
    childPlyNode.nextSibling();
    }
    }
    @

    Not sure what other information would be helpful.

    Thanks in advance for any help!

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      Try in .pro
      @
      QT+= xml
      @

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MichelleK
        wrote on last edited by
        #3

        Still have the same problem. Since I wrote this I made a copy of the project and deleted all of this code out of the project copy and I am still getting these errors on code that is no longer there. I really don't understand at all. Perhaps something is corrupt, although I can not imagine what I did to cause something like that. I am so stuck!

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          Do you have several versions of Qt installed?
          Respectively, what version did you install and which compiler are using?

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • M Offline
            M Offline
            MichelleK
            wrote on last edited by
            #5

            Sorry for the rant yesterday. I figured out today that when I a made the copy of the project into another directory and brought the new copy into Qt, although I was changing the new copy, when I told it to build and run, Qt was running the version from the original directory. Evidently the original directory is hardcoded somewhere and always refers to that for the build and run. Ugh!

            Anyway, back to your questions. I am running Qt 5.0.2 Commercial version with the MSVC 11.0 compiler. And no, I only have this version of Qt installed.

            1 Reply Last reply
            0
            • K Offline
              K Offline
              koahnig
              wrote on last edited by
              #6

              Beware that you cannot mix different compiler versions neither within of the different msvc versions nor of MinGW. So, if you have msvc2010 as toolchain you need to use pre-compiled Qt lib compiled with msvc2010 or you have to compile the libs yourself. msvc2008 and msvc2012 pre-compiled Qt libs do not go along with msvc and vice-versa. I am pondering a bit on this, because this is a common problem and from this you see errors as yours.

              From experience I would recommend to copy only the C++ source and header across to a freshly created project. Especially in your case, when trying to find the source of your problem. Even so, it creates a bit of work when importing and selecting the sources involved. Otherwise it is very frustrating.

              Do you have vsaddin installed? Unfortunately you can't with express version of msvc, but I assume that you have a full version.

              Vote the answer(s) that helped you to solve your issue(s)

              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
              • Unsolved