PDA

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



jmalicke
1st July 2014, 20:13
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.

ChrisW67
1st July 2014, 21:46
Rerun qmake in the db folder.