简体   繁体   中英

cpplint error when I need a header to be included before any other header

I have a header which in certain files needs to be ahead of any other headers. But cpplint complains as follows:

Found C system header after other header. Should be: V iew.h, c system, c++ system, other. [build/include_order] [4]

and in certain cases:

Found C++ system header after other header. Should be: TorqRootViewWin10.h, c system, c++ system, other. [build/include_order] [4]

I thought maybe // NOLINT could work, but it looks like it only works on errors in the specific line in which it is added, in this case the errors are in the following lines and not on the line of the header i included ahead of others. The other option I have is to use // NOLINT in all the other lines following my header. But that feels dirty. Is there any other way of doing this?

No, the NOLINT syntax is quite limited, also see google#31.

The error category can be removed in the command line options to never check include order, if your project does not want to follow the order required by cpplint.

I cannot tell from your error description whether you believe cpplint is wrong or inconsistent about it's warning, or whether you just wish to order your headers in a different way than cpplint.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM