Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Include files in Qt ,the location of libraries

Include files in Qt ,the location of libraries

Scheduled Pinned Locked Moved Qt Creator and other tools
4 Posts 2 Posters 3.7k Views
  • 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.
  • Q Offline
    Q Offline
    QSamBok
    wrote on last edited by
    #1

    Hi,
    I am new to Qt and am trying to learn from an open source project called qt-box-editor.When I open the project in Qt creator i find that includes like the following

    @
    #include <leptonica/allheaders.h>
    @

    are underlined meaning that something is wrong.These are libraries that the project uses,one is leptonica and the other is tesseract.I know I can go and copy the headers from the libraries one by one in my project but I want to learn the proper way to do this.

    My .pro file refers to them like this:
    @
    LIBS += -llept -ltesseract
    @

    To wrap up my problem is this :where can I put those libraries to make my project compile normally.And just to be sure,these are static libraries,right?
    Sorry if I ask stupid questions as I am trying to find my way into this.
    Thanks.
    Edit:I am using Windows 7,32bit, vs2010 and Qt 4.8.1 Qt Creator 2.4.1

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      welcome to devnet

      The .pro files are input files for qmake. The "qmake syntax":http://qt-project.org/doc/qt-4.8/qmake-project-files.html may be found here. Also Qt creator is reading the .pro file and shares the syntax.

      The "LIBS":http://qt-project.org/doc/qt-5.0/qtdoc/qmake-variable-reference.html#libs parameter is for the libraries, while you need to use the "INCLUDEPATH":http:// for the include path.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        QSamBok
        wrote on last edited by
        #3

        Thanks,
        just to be clear,I use

        @
        #include "-----------------------------"
        @

        when the header file is in some directory and use

        @
        #include <----------------------------->
        @

        when the header file is encapsulated in a library.What should I do to be able to use the second syntax and compile without getting those underline errors.
        Thanks.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          [quote author="QSamBok" date="1371538683"]Thanks,
          just to be clear,I use

          @
          #include "-----------------------------"
          @

          when the header file is in some directory and use

          @
          #include <----------------------------->
          @

          when the header file is encapsulated in a library.What should I do to be able to use the second syntax and compile without getting those underline errors.
          Thanks.
          [/quote]
          Those are the include declarations in the source code. The include files for libraries are typically on separate directories as you note. Qt creator needs to know where to find these includes, as the compiler has to know as well. The qmake LIBS is for libraries as you already found out, but it is only affecting the linking step, not the compilation of your source code.
          For compilation your compiler has to know where the includes are found and also has Qt creator to know where to find your includes.
          Therefore, you have to add in the INCLUDEPATH the folders/directories with the include files. The path may be completely identical to the one you are passing to LIBS, but you have to declare separately.

          Vote the answer(s) that helped you to solve your issue(s)

          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