Sorry, I don't understand what you try to accomplish. Are you trying to document how your library has to be used by a client program? In this case, I've seen instructions like:
"... place an include directive to <cool_library.h> in your program"
"... place an include directive to <cool_library.h> before the include directive for <not_so_cool.h>"
If you are looking for something else, try to explain more.
It is still not clear what you mean by "the process". There is no process as such, you just need to ensure that the compiler can find all declarations and/or definitions of any functions that you are trying to use. Either within your source file or in an associated header.
The source code may be using definitions of classes/functions etc in an external library. The header file provides this information so the compiler can create a reference in the object code. Such references will then be used by the linker to fix the links to a library or other object code module. For example given the followin directory structure:
you might have:
// Library.h the defintions of the library, in the LIB subdirectory
void Foo(char* name);
// Library.c the implementation of the library, in the LIB subdirectory
void Foo(char* name)
printf("Hello, World! A message from %s\n", name);
//Implementor.cpp the program that will use the library, in the CLIENT subdirectory
#include"../LIB/Library.h"int main(int argc, char** argv)
The build process gets the #include of the library but fails to find the
first "#include in the library header file.
I am a little confused by some of your terminology, and also it is unclear which system you are using for the build. So a few possible ideas:
1. If this is using Visual Studio on Windows, you can add the locations of include directories to the Project settings. The compiler will search all such locations for include files.
2. If you are using a Makefile then add the include locations to the CPPFLAGS macro in the form "-I <include location>".
3. If the location of one of the headers is relative to the current directory then you can add the details to the #include statement thus:
4. If it is something else then please provide the details.
I am using Linux and QtCreator (IDE?)
One of the "features" of QTCreator is to manage several applications - they call it "projects" .
These projects are independent from each other, they only appear together in SUBDIRS tree.
Sort of nice management tool.
I can build a library using QtCreator and "add it " to the project. Works as expected.
I can add a standard Qt project to my SUBDIRS tree and change plain .cpp project to static library. No problem there.
I can make a reference - using #include - to the library, same as I did when "including" the real library.
The compiler "access" the library file - no issue.
The problem is - the library include file has / contains a slew of another includes and compiler fails to find the first one and build process is finished...
In my interpretation
since when I build the library and there is no issue with the includes
my usage of the library "Includes" is on different level - hence I am missing another
The directive should be in my source code , not in the library.
I prefer to solve this in C code , but I do have an option to add it to "make".
"Make" has sort of "includes" added by building the library, but they are for linker.
I have never used QTCreator so cannot offer any proper advice I am afraid. But from what you are saying you need to adjust some #include statements so that the compiler can find other files. And since we do not know the structure of your project or the content of the includes, it is difficult to guess what may be the actual change that is required.
You have a good point - the Qt "projects management" structure looks very suspicious.
The "projects" work as expected - individually.
But the "include" do not "line up" when projects are used as "LIB CLIENT"