0

My C++ code use third-party library, so I have to add the library path to flycheck-clang-include-path to avoid can't find header file error.

But I don't want flycheck to do the syntax check on that library.

Because it always report warning/error on any file which include header files from that library.

  • I'm not sure I understand you: Do you want to use Flycheck in a C++ file that includes a header from your library while ignoring all errors and warnings from that header, or do you want to visit a file from the library without Flycheck being enabled automatically? – lunaryorn Dec 5 '15 at 8:25
  • I am expecting the former one. But if the solution can do both will be great. – Enze Chi Dec 5 '15 at 11:24
  • That's impossible. You cannot check a file whose includes don't pass the compiler. Includes are just textual substitutions after all; a single faulty include renders the entire file invalid. You have to configure Flycheck so that it accepts the includes without errors. – lunaryorn Dec 5 '15 at 12:20
0

You can use the -isystem compiler option to suppress such warnings. If you're using a .dir-locals.el setup:

((c++-mode . ((flycheck-clang-args . ("-isystem/path/to/3rd-party-libs/include")))))

In this case you may need to configure that variable content as safe, e.g. in .emacs (if you trust any clang args):

(put 'flycheck-clang-args 'safe-local-variable (lambda (xx) t))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.