What is the current state?
My folder structure:
--home
|---an_awesome_lib
| |---Core
| |---src
| | |---header_of_lib.h
| |
| |---build
| |---libawesome.so
|
|---framework
|---project
|---my_program_header.h
In my_program_header.h I have the following line:
#include <an_awesome_lib/Core/src/header_of_lib.h>
I tell g++:
-I</home/an_awesome_lib/Core/src/header_of_ib.h> -lawesome -L/home/an_awesome_lib/build
Problem Description
When I write #include<home/an_awesome_lib/Core/src/header_of_lib.h>
the compiler does not throw an error. But I do not want to do it. I want sth. like #include <an_awesome_lib/Core/src/header_of_lib.h>
This is a simple problem and it has been asked very often. However I do not see the relationship between the paths given to g++ and the path in #include in the code.
Where I found some information:
I read there but there was no complete explanation which puts this all together.
What is the difference between #include <filename> and #include "filename"?
https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html
How do I include a path to libraries in g++
Using (relative) paths to shortcut in include statements in C++
What I want
I hope you have a general explanation which puts this in a context. The following bullet points are just some suggestions to make it more clear what I would like to know.
- When do I need to tell the whole path?
- When is a relative path sufficient?
- How does the path in the header file relate to the path given to g++? Are they in a relationship?
- Are there multiple solutions, one which restricts it a bit more, one which is more open?