I’m new to programming and especially C++ which I’m keen to learn, although out of all the text books or external links I have studied I can’t seem to find this.
here goes.
If I have two classes (class A && class B)
Class A has a namespace A_NS;
Class B has a namespace B_NS;
both these classes are located in foreign folders
Class A -> fileA.h (FolderA)
Class B -> fileB.h (FolderB)
My Question is:
in class A, how can I #include<B_NS/fileB.h>
I want to reference my fileB.h via a sort of common interface? is it the namespace I use here?
I wouldn’t want to use the folder name e.g. <folderB/fileB.h>
Because in reality the folder is a few directories down.
I just don’t know how to include it, I was wondering if namespace could do it as I have a number of files in different directories I would like coupled under one common type of name, if that makes any sense ^^
Im sorry this is my first post on Stackoverflow and I find it hard to put clearly my issue but if anyone could please provide some help I would really appreciate it.
This is compiler-specific, which is probably why your textbooks don’t cover it, but all compilers have some way of putting a directory on the include path. With GCC, you’d use the
-Ioption:Namespaces are entirely separate from file paths to modules/headers.