QtCore/QtGlobal: No such file or directory when building static archive



  • I am trying to build two libraries: one static one shared. The problem is with the static library. I have the following folders:

    @src/
    db/
    dbal.h
    dbal.pro
    dll/
    Distribution.h
    dll.pro
    project.pro@

    db is static and dll is shared

    Distribution.h

    @#ifndef DISTRIBUTION_H_
    #define DISTRIBUTION_H_

    #include <QtCore/QtGlobal>

    #if defined(BUILDING_DLL)
    #define DLL_FUNCTION Q_DECL_EXPORT
    #else
    #define DLL_FUNCTION Q_DECL_IMPORT
    #endif

    #endif /* DISTRIBUTION_H_ */@

    Now here is the file inside db/ that includes Distribution.h

    dbal.h

    @#ifndef DBAL_H_
    #define DBAL_H_

    #include "Distribution.h"

    ...

    #endif@

    db.pro

    @TARGET = db
    TEMPLATE = lib
    CONFIG = staticlib c++11

    QT += core

    INCLUDEPATH += ../dll

    HEADERS += dbal.h
    HEADERS += dbal_sqlite.h

    SOURCES += dbal.cpp
    SOURCES += dbal_sqlite.cpp

    ######################################################################

    Build to custom directories

    ######################################################################

    DESTDIR = ../../build/debug/db

    OBJECTS_DIR = $$DESTDIR/.obj
    MOC_DIR = $$DESTDIR/.moc
    RCC_DIR = $$DESTDIR/.qrc
    UI_DIR = $$DESTDIR/.ui@

    When I run make in the db/ folder I get the following error: QtCore/QtGlobal: No such file or directory. It also appears that there are missing -I commands.

    Here is my log:

    @make all
    cd src/db/ && ( test -e Makefile || /usr/lib/x86_64-linux-gnu/qt5/bin/qmake /mnt/record/_dev/linux/projects/cdt/wasp/src/db/db.pro -o Makefile ) && make -f Makefile all
    make[1]: Entering directory `/mnt/record/_dev/linux/projects/cdt/wasp/src/db'
    g++ -c -m64 -pipe -O2 -std=c++0x -I/usr/share/qt5/mkspecs/linux-g++-64 -I. -I../dll -o ../../build/debug/db/.obj/dbal.o dbal.cpp
    In file included from dbal.h:9:0,
    from dbal.cpp:3:
    ../dll/Distribution.h:4:27: fatal error: QtCore/QtGlobal: No such file or directory
    #include <QtCore/QtGlobal>
    ^
    compilation terminated.@


  • Moderators

    What is the content of your db/dll.pro file? It looks like qmake wasn't run properly and didn't build the makefile with the Qt stuff.

    So you are correct there are missing -I and -L from the make.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.