Search code examples
c++includeclang-format

clang format: disable ordering includes


In our C++ project, the order of our includes is regularly changed. This is a problem since we are using some third-party libraries which require a specific include order to avoid problems.

I know, this is bad but we have to deal with it.

Unfortunately, the order of our includes is regularly changed and I suppose that this is due to clang-format. I found a page where you can specify a variable includeCategories. However, I do not fully understand how it works. I simply want to completely disable the ordering of includes. How can I do this?


Solution

  • Have you tried: SortIncludes: false?

    You can generate a .clang-format with preview here: https://zed0.co.uk/clang-format-configurator/