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. That for an error in QDomDocument?

That for an error in QDomDocument?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.0k 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.
  • W Offline
    W Offline
    WebSofter
    wrote on last edited by
    #1

    I'm trying to create an object QDomDocument, but there is an error

    "Image...":http://beta.hstor.org/files/f50/975/5a4/f509755a4c4b4777b5cbd5363982796c.png

    Console Errors:
    @
    07:27:07: Выполняются этапы для проекта Formula...
    07:27:08: Настройки не изменились, этап qmake пропускается.
    07:27:08: Запускается: «C:\Qt\Tools\mingw48_32\bin\mingw32-make.exe»
    C:/Qt/Tools/mingw48_32/bin/mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory 'C:/Qt/Tools/QtCreator/bin/build-Formula-Desktop_Qt_5_2_1_MinGW_32bit-Debug'
    g++ -Wl,-subsystem,windows -mthreads -o debug\Formula.exe debug/main.o debug/mainwindow.o debug/moc_mainwindow.o -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -lqtmaind -LC:\Qt\5.2.1\mingw48_32\lib -lQt5Widgetsd -lQt5Guid -lQt5Cored
    debug/mainwindow.o: In function Z8readDatav': Makefile.Debug:80: recipe for target 'debug\Formula.exe' failed mingw32-make[1]: Leaving directory 'C:/Qt/Tools/QtCreator/bin/build-Formula-Desktop_Qt_5_2_1_MinGW_32bit-Debug' makefile:34: recipe for target 'debug' failed C:\Qt\Tools\QtCreator\bin\build-Formula-Desktop_Qt_5_2_1_MinGW_32bit-Debug/../Formula/mainwindow.cpp:26: undefined reference to _imp___ZN12QDomDocumentC1Ev'
    C:\Qt\Tools\QtCreator\bin\build-Formula-Desktop_Qt_5_2_1_MinGW_32bit-Debug/../Formula/mainwindow.cpp:26: undefined reference to `_imp___ZN12QDomDocumentD1Ev'
    collect2.exe: error: ld returned 1 exit status
    mingw32-make[1]: *** [debug\Formula.exe] Error 1
    mingw32-make: *** [debug] Error 2
    07:27:10: Процесс «C:\Qt\Tools\mingw48_32\bin\mingw32-make.exe» завершился с кодом 2.
    Ошибка при сборке/установке проекта Formula (комплект: Desktop Qt 5.2.1 MinGW 32bit)
    Во время выполнения этапа «Сборка»
    07:27:10: Прошло времени: 00:03.
    @

    Here is my source:

    @
    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <iostream>
    //#include <QDomDocument>
    #include <QtXml/QDomDocument>
    #include <QFile>
    #include <QXmlStreamReader>
    //#include <QDebug>

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }

    QString libPath = "C:\library.xml";
    void readData(void)
    {
    //The QDomDocument class represents an XML document.
    QDomDocument xmlBOM;
    // Load xml file as raw data
    /*QFile f(libPath);

    if (!f.open(QIODevice::ReadOnly ))
    {
        qDebug("Не удалось загрузить файл");
    }else
    {
        qDebug("Файл удачно загружен");
    }
    */
    

    }

    void MainWindow::on_pushButton_clicked()
    {
    readData();
    }

    void MainWindow::on_pushButton_5_clicked()
    {
    readData();
    }
    @

    1 Reply Last reply
    0
    • sierdzioS Online
      sierdzioS Online
      sierdzio
      Moderators
      wrote on last edited by
      #2

      You need to add this to your .pro file:
      @
      QT += xml
      @

      Also, you can simply include QDomDocument, no need to include QtXml/QDomDocument.

      (Z(:^

      1 Reply Last reply
      1
      • sierdzioS Online
        sierdzioS Online
        sierdzio
        Moderators
        wrote on last edited by
        #3

        Hey mate, please don't report my posts to thank me, that has an entirely different purpose!

        If you want to thank, write a reply. If you want to do it silently, send me a private message. "report" link is there to report spammers, etc.

        (Z(:^

        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