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. [SOLVED] qmake - how to correctly setup the .pro file ?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] qmake - how to correctly setup the .pro file ?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 1.5k 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.
  • X Offline
    X Offline
    XelaG
    wrote on last edited by
    #1

    Hello,

    I'm writing some classes defined in several files. The test application is defined in a sub directory and I can't correctly setup the .pro file.
    Here is the source tree (don't pay attention to the filenames):
    @c:\Project\QT/
    + Files/
    + file1.cpp
    + file1.h
    + file2.cpp
    + file2.h
    + Lib/
    + lib1.cpp
    + lib1.h
    + lib2.cpp
    + lib2.h
    + TestApp/
    + build-TestApp-Desktop_Qt_5_2_0_MinGW_32bit-Debug/
    + TestApp/
    + TestApp.pro
    + mainwindow.cpp
    + mainwindow.h
    + mainwindow.ui@

    Using QTCreator I added all the header and cpp files into the project and ran qmake. But When I compile the project, the compiler doesn't find <QStringList> which is included in file1.cpp.
    I added INCLUDEPATH is the .pro file and ran qt but it is worth.

    When compiling the files created by qtcreator mainwindow.* anf file1.cpp all the include paths are correctly passed to g++.

    @g++ -c -pipe -fno-keep-inline-dllexport -g -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\WeatherTest -I"..........\Qt\5.2.0\mingw48_32\include" -I"..........\Qt\5.2.0\mingw48_32\include\QtWidgets" -I"..........\Qt\5.2.0\mingw48_32\include\QtNetwork" -I"..........\Qt\5.2.0\mingw48_32\include\QtGui" -I"..........\Qt\5.2.0\mingw48_32\include\QtCore" -I"debug" -I"." -I"." -I"..........\Qt\5.2.0\mingw48_32\mkspecs\win32-g++" -o debug\file1.o ......\Files\file1.cpp@

    but when compiling file2 no include paths are specified !!!!

    @g++ -pipe -fno-keep-inline-dllexport -g -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN ../../../Files/file2.cpp -o ../../../Files/file2@

    How Can I add several external source files into Qt without getting mad ?

    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Asperamanca
      wrote on last edited by
      #2

      It would help if you posted the content of your pro file.

      1 Reply Last reply
      0
      • X Offline
        X Offline
        XelaG
        wrote on last edited by
        #3

        I fixed it.

        the issue was not in the .pro file but in the source files.
        lib2.h included a file named File1 (not file1.h) this file contained
        @#include "file1.h"@

        It seems that when source files include header named with not .h extension, no include paths are passed to g++.

        "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          Does File1 exists ?

          When you include a file whether it ends or not with a .h, the file must still exist

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • X Offline
            X Offline
            XelaG
            wrote on last edited by
            #5

            of course,
            otherwise g++ would tell me it doesn't find the included file.

            "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding

            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