H
H
Hello America2014-05-30 06:30:14
Qt
Hello America, 2014-05-30 06:30:14

Error when connecting QDomDocument in Qt

I have 2 Qt projects with xml reading based on QDomDocument class which I have included as #include<QDomDocument>.
I’m trying to do the same in the second project, but it wasn’t there and it refuses to connect the library as #include <QDomDocument>, but Qt doesn’t find it, but it finds and connects like that #include <QtXml/QDomDocument>and here another problem got out - qt refuses to create a QDomDocument object and displays the following
f509755a4c4b4777b5cbd5363982796c.png
The console is also solid magic:

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.

The task is banal - to create a QDomDocument object in mainwindow.cpp:
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("Файл удачно загружен");
    }
    */
}

What could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
EXL, 2014-05-30
@websofter

Read Assistant and Qt documentation. The problem should be corrected by adding the line:
In your "*.pro" project file. There is no magic here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question