Hi.
I've a problem with an application that I'm developing.
In this application, I've three projects:
A - The application
B - a library used by the application
C - a library used by B
in the B project, I declare the class in his header file (libB.h), like this:
#include "libB_global.h"
#include "libC.h"
class METEOGRIDSHARED_EXPORT AtmosphericGrid
{
... some code using library C
}
#include "libB_global.h"
#include "libC.h"
class METEOGRIDSHARED_EXPORT AtmosphericGrid
{
... some code using library C
}
To copy to clipboard, switch view to plain text mode
To do this, in the .pro of the B project I add the path in which the class header of library C is defined, and I add the header of that class, so che .pro of the library B contains something like this:
# Including project C
INCLUDEPATH += ../../libC
HEADERS += libC.h
# Including project C
INCLUDEPATH += ../../libC
HEADERS += libC.h
To copy to clipboard, switch view to plain text mode
Now, in the application A, I want to use library B. To do this, I add in the .pro file of A application, the following lines:
# Using B Library
DEFINES -= B_LIBRARY
LIBS += ../../bin/libB.so
INCLUDEPATH += ../../B
HEADERS += libB.h
# Using B Library
DEFINES -= B_LIBRARY
LIBS += ../../bin/libB.so
INCLUDEPATH += ../../B
HEADERS += libB.h
To copy to clipboard, switch view to plain text mode
But, if I do this, I've a compiler error:
In file included from ../A/main.cpp:5:0:
../../libB/libB.h:6:29: fatal error: libC.h: missing file or directory
(the message cannot be equal, because I've translated it from italian).
In practice, it does not compile because in A I've a reference for the C header (included in the B header).
In other words, to compile A, I need header B, that includes header C that I must define in A. If I don't define C path in A, it doesn't work But I don't want to do this, because I lost all advantages in using different projects.
I'd like that A depends only from B, withouht taking in account all dependies of B, but it'a impossible if I use header files as I'a actually doing.
How can I achieve this result?
Thanks in advance for your replies.
Bookmarks