11

I'm using flycheck for C++ development, and get the following warning:

#pragma once in main file

In all headers included in a main file. Searching the webs, I get the impression this has something to do with how gcc and clang (both give the same warning) compile for flymake.

I would like to get rid of this warning. Is there anything I can do?

  • It will be easier to figure out how to suppress this warning if we can reproduce it first. Can you give an example file or files that exhibit the problem, while still being as simple as you can make them? – Ben Liblit Oct 31 '15 at 20:36
  • I have a question similar to yours, I have an answer. – Pradana Aumars Feb 27 '18 at 23:43
2

Clang has an option to disable this warning. Adding the following to my config fixed the issue for me.

(with-eval-after-load "flycheck"
    (setq flycheck-clang-warnings `(,@flycheck-clang-warnings
                                    "no-pragma-once-outside-header")))

Unfortunately, I don't know if similar option exists for gcc.

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.