Search code examples
c++cgccvisual-c++

Can my compiler be configured to error if an include path doesn't exist? (GCC, MSVC)


To catch technical debt, I would like the compiler to throw an error if one of the include paths does not exist. Is this possible with either GCC or MSVC?


Solution

  • Does -Wmissing-include-dirs command line switch for GCC suit your needs? For making the compiler generate error, replace -W with -Werror, i.e. -Werror=missing-include-dirs

    https://godbolt.org/z/f7cvbKjcP