Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

company-clang-arguments errors when opening file and company-clang not working #61

Open
jade2k11598 opened this issue Jan 17, 2020 · 0 comments

Comments

@jade2k11598
Copy link

Hi,
So I'm in the process of following instructions to setting up C++ IDE found in http://tuhdo.github.io/c-ide.html. I'm at the part of setting up the company-mode with clang (http://tuhdo.github.io/c-ide.html#orgheadline15). Followed all the setups, including the setup of the .dir-locals.el placed at the project root, which has the following content:
((nil . ((company-clang-arguments . ("-I/Users/jade/spdlog/include/")))))

But every time I try to open a file I get this error:

The local variables list in /Users/jade/spdlog/
contains values that may not be safe (*).

Do you want to apply it?  You can type
y  -- to apply the local variables list.
n  -- to ignore the local variables list.
!  -- to apply the local variables list, and permanently mark these
      values (*) as safe (in the future, they will be set automatically.)

  * company-clang-arguments : ("-I/Users/jade/spdlog/include/")

I enter y to get pass this point, but every time I attempt to trigger the company completion to include a header file found in the include path set above, it fails to recognize any headers found in that subdirectory (e.g. I just get a message "No completion found"). For instance in that include path, there is a spdlog subdirectory which contain numerous header files. Even after typing:

#include "spdlog/

followed with trigger the key that triggers company-complete, emacs prompts "No completion found".

I know I have the desired key for company-complete setup correctly, because I have also setup the company-c-headers feature and it has no problem finding the various system headers in the path setup for company-c-headers, when triggering the same company-complete key. But it never succeeds finding headers found in the path setup for company-clang-arguments. I suspect that the error I get when I first open up any file in that project, is a hint that somehow there's something wrong in my setup, but I'm not that familiar with trouble-shooting emacs lisp.

Here's what is in my init.el file as far as setting up company related stuff:

(require 'company)
(add-hook 'after-init-hook 'global-company-mode)
(setq company-backends (delete 'company-semantic company-backends))
(define-key c-mode-map  (kbd "C-<tab>") 'company-complete)
(define-key c++-mode-map (kbd "C-<tab>") 'company-complete)

(eval-after-load 'company
  '(add-to-list
    'company-backends 'company-c-headers)
  )

(setq company-c-headers-path-system '("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/"
                                      "/usr/local/include/"))

Any help would be greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant