0

While doing some newbie development in Qt I faced with challenge to understand what to add to my *.pro file. For example, I'm adding #include <QDomDocument>. After save it starts saying that

error: QDomDocument: No such file or directory

. I go to Google, past this error and find on Stackoverflow what to add to my .pro file.

How this QT += xml is named and where to find it in documentation?

Andrii Muzychuk
  • 1,151
  • 3
  • 20
  • 28
  • 2
    It's named **module**. Qt is divided into modules and with `QT += ...` you tell qmake which modules to use. This will add the directories to the include path (so `#include` finds the files) as well as link against the module library (every module is a library which has to be linked to the executable). – leemes Sep 15 '14 at 16:43
  • You can see the modules for Qt 4.8 [here](http://qt-project.org/doc/qt-4.8/modules.html). For Qt 5 you can see them [here](http://qt-project.org/doc/qt-5/qtmodules.html). – thuga Sep 16 '14 at 07:02

1 Answers1

2

Try search something about Qt in Qt Creator help:

  1. Press Help (left side)

  2. Type qdomdocument in Search for:

  3. Choose QDomDocument class.

Now you see this table:

Header: #include <QDomDocument>
qmake:  QT += xml
Inherits:   QDomNode.

It is answer, you can find it in documentation. And you'll know where you should search.

Of course you can find this in Internet, but for example:

This link has qmake line: http://qt-project.org/doc/qt-5/qdomdocument.html

This link hasn't qmake line: http://qt-project.org/doc/qt-4.8/qdomdocument.html

Help in Qt Creator always gives you actual info, but Google first of all give you qt-4.8 documentation.

Jablonski
  • 18,083
  • 2
  • 46
  • 47