0

I have the following init file:

:tools
       ;;ansible
       ;;debugger          ; FIXME stepping through code, to help you add bugs
       ;;direnv
       ;;docker
       ;;editorconfig      ; let someone else argue about tabs vs spaces
       ;;ein               ; tame Jupyter notebooks with emacs
       (eval +overlay)     ; run code, run (also, repls)
       ;;gist              ; interacting with github gists
       lookup              ; navigate your code and its documentation
       lsp
       magit             ; a git porcelain for Emacs
       ;;make              ; run make tasks from Emacs
       ;;pass              ; password manager for nerds
       ;;pdf               ; pdf enhancements
       ;;prodigy           ; FIXME managing external services & code builders
       ;;rgb               ; creating color strings
       ;;taskrunner        ; taskrunner for all your projects
       ;;terraform         ; infrastructure as code
       ;;tmux              ; an API for interacting with tmux
       ;;upload            ; map local to remote projects via ssh/ftp

       :os
       (:if IS-MAC macos)  ; improve compatibility with macOS
       ;;tty               ; improve the terminal Emacs experience

       :lang
       ;;agda              ; types of types of types of types...
       (cc +lsp)                ; C/C++/Obj-C madness
       ;;clojure           ; java with a lisp
       ;;common-lisp       ; if you've seen one lisp, you've seen them all

Now I cannot seem to get autocompletion to work, though lsp is enabled.

My screen looks like this:

enter image description here

I cannot seem to find any step by step docs for configuring doom emacs for c++. How can I go about setting up doom emacs for c++ development on Mac OS 10.15.6?

4
  • Did you have a backend installed? I guess the default would be clangd.
    – hrkrshnn
    Commented Aug 21, 2020 at 6:25
  • For header auto completion, there is an interesting package called company-c-headers, you can check it out and see if it works for you. Good luck!
    – Fermin MF
    Commented Aug 21, 2020 at 8:25
  • Hello, yes I have followed the instructions here: github.com/hlissner/doom-emacs/tree/develop/modules/lang/cc It still doesn't seem to work for autocompletion of headers. Any ideas? Commented Aug 21, 2020 at 11:59
  • For c++ completion, you have to include the path location to company-c-headers: (add-to-list 'company-c-headers-path-system "/usr/include/c++/8/") The last part, is the route where the c++ libraries are located.
    – Fermin MF
    Commented Sep 3, 2020 at 13:52

1 Answer 1

0

I had the same problem on Mac, with clangd. It was fixed by adding a compile_flags.txt file to the project root, with CPPFLAGS options copied from the Makefile.

Make sure to split CPPFLAGS with an option per line in the file.

-g
-Wall

etc.

https://releases.llvm.org/8.0.0/tools/clang/tools/extra/docs/clangd/Installation.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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