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/QHostAddressWhen I looked into my Linux Ubuntu folder
I only found QHostAddress in this folder:
usr/qt4/QtNetworkSo, 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[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
@Error warning is this:
QHostAddress: No such file or directory. -
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..
@ usr/qt4/QtNetwork @
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 ":http://doc.qt.nokia.com/4.7/modules.html
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.
-
[quote author="hpng" date="1308678213"]Where do you find information on what to include inn *;pro file?
Thanks.[/quote]It is indeed a little hidden. But you can find it in the module description (e.g. "here":http://doc.qt.nokia.com/4.7/qtnetwork.html 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 ;)