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. [SOLVED] QtCreator on mac problem building own library inside a project
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] QtCreator on mac problem building own library inside a project

Scheduled Pinned Locked Moved Qt Creator and other tools
11 Posts 3 Posters 3.3k 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.
  • D Offline
    D Offline
    dianyu
    wrote on last edited by
    #1

    Hello All,

    I am developing a project in mac os x under qtcreator with qt5.2. My project contains an application and three libraries developed by me all of them with their respectives .pro.

    I have seen that when i perform some changes to the libraries and then i build the solution. The libraries are build and the .a files are updated. But the changes done in the libraries are not present while debugging the app. Moreover, I have seen that inside the app bundle, the file that is inside Contents/MacOs/ with the name of the application is not updated.

    I can solve it doing a rebuild of the library, because then everything is updated and the changes can be visible in the debugging of the application. But this is not a good solution, because the libraries are quite big and wait for the rebuild of the whole library after every small change is horrible...

    This is not happening in VS when I develop the same project... What I am doing wrong??

    All the .pro files include a .pri file which is:

    @#################################### CONFIG ############################################
    #Añadimos las configuraciones que utilizaran la mayor parte de librerias
    #Ver : (http://doc.qt.nokia.com/latest/qmake-project-files.html)

    #Mostrar todos los warnings
    CONFIG += warn_on

    #Permite compilar el proyecto en modo debug y release
    CONFIG += debug_and_release

    #La aplicacion necesita una consola
    CONFIG += console

    #La aplicacion usara Qt
    CONFIG += qt

    #Muestra en VS los archivos con su estructura jerarquica de carpetas
    CONFIG -= flat

    #Hay que definir que extensiones de qt no por defecto vendran
    QT += opengl

    ################################## DIRECTORIOS #########################################

    #Directorio donde se guardan los ficheros ui_*.h
    UI_DIR = ui_headers

    #En funcion de la configuracion se decide donde se almacenaram
    CONFIG(debug, debug|release){
    MOC_DIR = moc_debug
    OBJECTS_DIR = obj_debug
    RESOURCES_DIR = resources_debug
    DESTDIR = ../bin/debug
    }CONFIG(release, debug|release){
    MOC_DIR = moc_release
    OBJECTS_DIR = obj_release
    RESOURCES_DIR = resources_release
    DESTDIR = ../bin/release
    }

    #Añadimos las rutas donde buscara el compilador para buscar cabezeras
    INCLUDEPATH+= include ui ui_headers ../
    INCLUDEPATH+= src/ply
    unix{
    INCLUDEPATH+= /usr/include
    INCLUDEPATH+= /usr/local/glew/include/GL
    }

    win32{
    INCLUDEPATH+= ../glew/include/GL
    INCLUDEPATH+= ../glm
    }

    #Indica a qmake donde tiene que buscar dependencias, de esta manera si modificamos un .h
    #los .cpp que dependan de el seran recompilados
    DEPENDPATH += include ui src ../ @

    The .pro file of the application is:
    @include (../general.pri)

    TEMPLATE = app
    LANGUAGE = C++
    TARGET = Noctiluca3D

    SOURCES += src/main.cpp
    src/Noctiluca3D.cpp \

    HEADERS += include/Noctiluca3D.h

    #FORMS = ui/MainWindow.ui

    #RESOURCES += images/main.qrc

    //unix version
    CONFIG(debug, debug|release){
    LIBS+= ../bin/debug/libNoctiMath.a
    LIBS+= ../bin/debug/libNoctiCore.a
    }CONFIG(release, debug|release){
    LIBS+= ../bin/release/libNoctiMath.a
    LIBS+= ../bin/release/libNoctiCore.a
    }

    unix{
    LIBS += -L/usr/local/glew/lib -lGLEW
    }@

    and the .pro files of the libraries are like this (I only copy one .pro file as example without headers and sources part):
    @
    include (../general.pri)

    TEMPLATE = lib
    LANGUAGE = C++
    TARGET = NoctiCore
    win32 {
    CONFIG += dll
    DEFINES += NOCTICORE_EXPORTS
    }
    unix{
    CONFIG += staticlib
    }

    FORMS = ui/MainWindow.ui

    RESOURCES += images/main.qrc

    CONFIG(debug, debug|release){
    #LIBS += -L../bin/debug -lNoctiMath
    LIBS += ../bin/debug/libNoctiMath.a
    }CONFIG(release, debug|release){
    #LIBS += -L../bin/release -lNoctiMath
    LIBS += ../bin/release/libNoctiMath.a
    }

    win32{
    LIBS += -L../glew/lib -lglew32
    }
    unix{
    LIBS += -L/usr/local/glew/lib -lGLEW
    }
    @

    Thanks to all!

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

      Hi,

      It's because on windows you are using a shared library and on unix a static one.

      You need to add

      @PRE_TARGETDEPS += "../bin/release/libNoctiMath.a"@

      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
      • D Offline
        D Offline
        dianyu
        wrote on last edited by
        #3

        Hello, it works!

        Thank you very much for your reply!

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dhjdhj
          wrote on last edited by
          #4

          I'm having a similar problem ---- I have .PRI files that have lines in them of the form
          @
          INCLUDEPATH *= $$PWD
          DEPENDPATH *= $$PWD
          HEADERS *= qtypes.h
          Conversions.h
          DSSettings.hpp
          MiscUtils.hpp
          SOURCES *= DSSettings.cpp
          MiscUtils.cpp
          @

          but the header and source files don't appear in QT Creator 3(and aren't found during compilation). This used to work when I was using QT4 (with whatever version of Creator was appropriate)

          I have observed that if I write
          @
          HEADERS *= $$PWD/qtypes.h ....
          @

          that works fine.

          I have checked with message that both INCLUDEPATH and PWD have the right values

          [edit: Added missing coding tags @ SGaist]

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dhjdhj
            wrote on last edited by
            #5

            No one, huh?
            Sigh

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

              Doesn't it work when you add $$PWD in front of your files ?

              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
              • D Offline
                D Offline
                dhjdhj
                wrote on last edited by
                #7

                Yes --- but I never had to do that with previous versions of Creator.

                Isn't that the whole point of INCLUDEPATH?

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

                  No, with INCLUDEPATH you tell where to look for includes, however it won't show the file in these folders. It's the job of HEADERS and SOURCES

                  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
                  • D Offline
                    D Offline
                    dhjdhj
                    wrote on last edited by
                    #9

                    Well, whatever it was, it used to work in the old Creator --- I'd have noticed a long time ago if those files weren't showing up, the project in question has been around for 4 years.

                    I would also add that (building under the current version of Qt Creator), ignoring their not showing up in the project tree, the files don't get found by the compiler either, even with INCLUDEPATH configured.

                    If INCLUDEPATH is supposed to be able to tell you where to look for stuff, then the system should be able to find them with explicit PWD prefixed as well.

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

                      INCLUDEPATH is a folder list for your compiler to search for includes

                      @INCLUDEPATH = /usr/local@

                      will result in

                      @gcc -I/usr/local@

                      It's not there for Qt Creator to show the files inside your project

                      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
                      • D Offline
                        D Offline
                        dhjdhj
                        wrote on last edited by
                        #11

                        Every one of my subfolder PRI files has the line

                        INCLUDEPATH *= $$PWD

                        so presumably that results in -I(value of PWD for that folder) so stuff should still be found.

                        In any case, I repeat my original issue -- in the old Qt Creator, the project was able to find all the files referenced in each .PRI file, WITHOUT the need to prefix the HEADER and SOURCES entries with $$PWD/

                        That doesn't work any more. So either it was a "flaw" that it used to work, or it is a bug that it doesn't work now.

                        Can't have it both ways.

                        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