That for an error in QDomDocument?



  • 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();
    }
    @


  • Moderators

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

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


  • Moderators

    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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.