Problem with including files

I have the following setup:

Folder C contains...
1. Folder A
- A.cpp
2. Folder B
- Folder B1
- B.h

In A.cpp, I need to include B.h but I always get a No Such File or Directory error. I have tried

 
#include <B/B1/B.h> 


which I think is supposed to be correct but it still generates an error.
Try
 
#include "B/B1/B.h" 

and make sure the project's root folder (C) is set up as an include folder. With gcc/g++:
 
g++ -I/path/to/C ...


Alternatively, you can use this path in your A.cpp, but I think it's not the best solution:
 
#include "../B/B1/B.h" 


In any case, you should use "", and not <>.
Last edited on
Topic archived. No new replies allowed.