spacemacs c++ layer报错

隔了一年,有需要写点c++程序。懒得用老方法配置,想试一下spacemacs c++layer, 如下配置

 (c-c++ :variables
        c-c++-backend 'lsp-clangd
        c-c++-default-mode-for-headers 'c++-mode
        c-c++-enable-clang-format-on-save t
        c-c++-lsp-enable-semantic-highlight 'rainbow
        )

打开一个cc文件,出现错误

LSP :: clangd:63321 initialized successfully
Error processing message (wrong-type-argument hash-table-p nil). [2 times]
Auto-evilification could not remap these functions in map ‘edebug-mode-map’:
   - ‘edebug-Go-nonstop-mode’ originally mapped on ‘G’

.cc文件的buffer里报一大堆错误

根据这个issue: https://github.com/syl20bnr/spacemacs/issues/8654

我也增加了一个空行后,下面的错误消失了。

Auto-evilification could not remap these functions in map ‘edebug-mode-map’:
   - ‘edebug-Go-nonstop-mode’ originally mapped on ‘G’

但这个还是没有解决,上图中的一堆报错还是没有解决, 感觉是找不到我的.h文件,这个怎么设置?

Error processing message (wrong-type-argument hash-table-p nil). [2 times]

问题定位为找不到我自己的include路径,试了网上几种方式,不知道如何正确的设置我的include目录路径

在spacemacs github 里发issue,一个好人提供了重要线索:

在git项目根目录创建一个文件compile_commands.json, clangd需要

现在开发c++很美好

2 个赞