1

I have hierarchy of files and folders containing C++ codes. They often include each other like:

#include "../../Foder1/Lib4/file12.hpp"

When I compile the code, in case of error, I see a message like:

Foder2/Lib7/../../Foder1/Lib4/file12.hpp:71:4: error <something>

While I prefer to see .. standing for parent directory is canceled out in the gcc error message:

Foder1/Lib4/file12.hpp:71:4: error <something>

Any option for calling gcc?

ar2015
  • 5,558
  • 8
  • 53
  • 110

1 Answers1

1

If you add -I [Folder...'s base dir] to your gcc call you can include files by #include "Foder1/Lib4/file12.hpp" and then messages should be better formatted.

Glapa
  • 790
  • 10
  • 20
  • Recommend changing the `<>` to `""`. Read more on why: http://stackoverflow.com/questions/21593/what-is-the-difference-between-include-filename-and-include-filename – user4581301 Dec 17 '15 at 07:34
  • Thanks for the tip! Edited. – Glapa Dec 17 '15 at 09:57
  • but... we know that this files are not in the same directory so what is the point for `""`? `<>` shows us that this file is included from "external path definition". – Glapa Dec 17 '15 at 10:04
  • You've got me there. Without the relative path the only reason left is stylistic: to separate external library headers and the project headers. That's an easily debatable and lost argument. – user4581301 Dec 17 '15 at 16:40