I am about to start writing a code in C++ for my PhD. Until now I worked with small code. All the files (sources and headers) in one directory.
Since I want to write a more organized code, I'll put files in different directories.
So what is the proper way to include files? Should I use something like
#include "../../folder/file.hpp" It doesn't look very clean. And is the code portable to Windows if includes are done this way?
../in#includes as confusing, dangerous, and bad style. (I use it only in rare specific situations where nobody else can see it.) In general, for large projects with many source code files, stored in multiple sub-directories, I prefer a basic "overall" include directory (which is used as include path, compiler arg.-I) and#includepaths relative to this./s in#includes are fine. Windows C++ compilers can read this as well, and, as you mentioned yourself, it's necessary to keep code portable.