Where to setup QT creator to locate all Qt include files?
Qt Creator 1.3.1
Based on Qt 4.6.2 (64 bit)
Hello:
When I import some files into Qt, I have build errors.
For example,, I declare this include in a file:
- #include <QHostAddress>
When I move cursor over the line the tool tip show this:
usr/qt4/QtNetwork/QHostAddress
When I looked into my Linux Ubuntu folder
I only found QHostAddress in this folder:
usr/qt4/QtNetwork
So, it seems Qt Creator cannot find the include file.
I was able to compile QT without my imported files.
I am perplex as to why I cannot do so with the inclusion of the imported file, since the includes were all Qt’s include files.
Please be specific about how i can tell Qt creator to search appropriate folders.
Cheers.
Addition:
I created another test application, and included
#include <QHostAddress>
See below.
- #include <QtGui/QApplication>
- #include "mainwindow.h"
- #include <QHostAddress>
- int main(int argc, char *argv[])
- {
- MainWindow w;
- w.show();
- return a.exec();
- }
Error warning is this:
QHostAddress: No such file or directory.
6 replies
Excuse me but what is the difference between
usr/qt4/QtNetwork/QHostAddress
and
QHostAddress in this folder:
usr/qt4/QtNetwork
About your problem, do you have
- QT += network
in your .pro file?
Did you add network in your pro file? Like..
- QT += core gui network
As for includes, you have two types, you could include globally using the class name like
- #include <QHostAddress>
Or a qualified path like
- #include <QtNetwork/QHostAddress>
Both of these work, because the Qt include directories contains the global directory as well as the directory below for each module.
Is that the issue or is it something else? Maybe, your Qt sources are not structured correctly..
You’re on linux i’m guessing and in linux the Qt includes (including the QtNetwork folder) are usually in a “include” folder. Anyway hope that sheds some light on your problem.
[ Edit: @loladiro: Same time same place again :) ]
Qt has several modules for which you can find an overview here [doc.qt.nokia.com]
If you click on a module you will see an explanation which also states which option to set in your pro file like the example shown to you.
Where do you find information on what to include inn *;pro file? Thanks.
It is indeed a little hidden. But you can find it in the module description (e.g. here [doc.qt.nokia.com] for QtNetwork). FYI, you can see what module it is in by looking at the breadcrumbs at the top of the page (e.g. Home -> Modules -> QtNetwork -> QHostAddress )
Edit: Eddy was faster ;)
You must log in to post a reply. Not a member yet? Register here!



