Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Where to setup QT creator to locate all Qt include files?
Forum Updated to NodeBB v4.3 + New Features

Where to setup QT creator to locate all Qt include files?

Scheduled Pinned Locked Moved General and Desktop
7 Posts 4 Posters 11.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hpng
    wrote on last edited by
    #1

    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[])
    {
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    return a.exec();
    }
    @

    Error warning is this:
    QHostAddress: No such file or directory.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      loladiro
      wrote on last edited by
      #2

      Excuse me but what is the difference between
      [quote]
      usr/qt4/QtNetwork/QHostAddress
      [/quote]
      and
      [quote]
      QHostAddress in this folder:
      usr/qt4/QtNetwork
      [/quote]
      About your problem, do you have
      @
      QT += network
      @
      in your .pro file?

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jim_kaiser
        wrote on last edited by
        #3

        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 :) ]

        1 Reply Last reply
        0
        • H Offline
          H Offline
          hpng
          wrote on last edited by
          #4

          Where do you find information on what to include inn *;pro file?
          Thanks.

          1 Reply Last reply
          0
          • EddyE Offline
            EddyE Offline
            Eddy
            wrote on last edited by
            #5

            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.

            Qt Certified Specialist
            www.edalsolutions.be

            1 Reply Last reply
            0
            • L Offline
              L Offline
              loladiro
              wrote on last edited by
              #6

              [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 ;)

              1 Reply Last reply
              0
              • EddyE Offline
                EddyE Offline
                Eddy
                wrote on last edited by
                #7

                @loladiro Just once ;)

                Man you're fast!

                Qt Certified Specialist
                www.edalsolutions.be

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved