emacs-lsp / emacs-ccls

Emacs client for ccls, a C/C++ language server
200 stars 29 forks source link

flycheck shows error messages when opening hh file #66

Closed shunlir closed 4 years ago

shunlir commented 4 years ago

I'm not sure if this is the right place to ask this question, but no error message are shown by flycheck when cc file opened. I'm using doom-emacs, and emacs-ccls. I opened ccls project to give it a try, code completion works fine. The following errors are showing (with ccls/src/serializer.hh opened):

serialize… 4 9 warning #pragma once in main file (c/c++-clang) serializ… 8 10 error 'llvm/Support/Compiler.h' file not found (c/c++-clang) utils.hh 56 6 error no template named 'optional' in namespace 'std' (c/c++-clang) utils.hh 57 6 error no template named 'optional' in namespace 'std' (c/c++-clang) utils.hh 60 29 error no type named 'string_view' in namespace 'std' (c/c++-clang) utils.hh 60 51 error no type named 'string_view' in namespace 'std' (c/c++-clang) utils.hh 102 14 error no type named 'nullopt_t' in namespace 'std'; did you mean 'nullptr_t'? (c/c++-clang) utils.hh 119 17 error no template named 'optional' in namespace 'std' (c/c++-clang)

But no error is showing with ccls/src/serializer.cc opened.

my configuration:

config.el

(use-package! lsp-mode
  :commands (lsp-mode lsp-define-stdio-client))

(use-package! lsp-ui
  :hook (lsp-mode . lsp-ui-mode)
  :config
  (set-lookup-handlers! 'lsp-ui-mode
                        :definition #'lsp-ui-peek-find-definitions
                        :references #'lsp-ui-peek-find-references)
  (setq lsp-ui-doc-max-height 16
        lsp-ui-doc-max-width 50
        lsp-ui-doc-enable t
        lsp-ui-sideline-ignore-duplicate t))

(use-package! dap-mode
  :after lsp-mode
  :config
  (dap-mode t)
  (dap-ui-mode t))

(use-package! company-lsp
  :after lsp-mode
  :config
  (set-company-backend! 'lsp-mode 'company-lsp)
  (setq company-lsp-enable-recompletion t))

packages.el:

(when (package! lsp-mode)
  (package! lsp-ui)
  (package! company-lsp)
  (package! dap-mode))

init.el: :lang (cc +lsp), :tools lsp

shunlir commented 4 years ago

A working configuration is to: (setq-default flycheck-disabled-checkers '(c/c++-clang c/c++-cppcheck c/c++-gcc)