[SOLVED] QtCreator on mac problem building own library inside a project
-
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 = Noctiluca3DSOURCES += 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!
-
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"@
-
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]
-
Doesn't it work when you add $$PWD in front of your files ?
-
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
-
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.
-
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
-
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.