How to configure .dir-locals.el file for emacs (for c/c++ project)?

 M-x add-dir-local-variable RET

Mode or subdirectory (default ....): nil RET

Add directory local variable: eval RET

Add eval with expression: (progn (company-mode t)(flycheck-mode t)) RET

Above will automatically turn on company-mode & flycheck-mode for the project files.

---------------------------------------------------

M-x add-dir-local-variable RET

Mode or subdirectory (default ....): c++-mode RET

Add directory local variable: flycheck-clang-language-standard RET

Add eval with expression: "c++20"

Similary add other variables so that final .dir-locals.el file looks like below:

;;; Directory Local Variables            -*- no-byte-compile: t -*-
;;; For more information see (info "(emacs) Directory Variables")

((nil . ((eval . (progn
   (company-mode t)
   (flycheck-mode t)))))

 (c++-mode . ((flycheck-clang-language-standard . "c++20")
     (flycheck-clang-include-path . ("/usr/include/postgresql"))
      (flycheck-gcc-include-path . ("/usr/include/postgresql")))))

=============
DONE!

No comments:

Post a Comment

If you have any doubts, please let me know.

Regarding site Free Browser Tool (https://free-browser-tools.mohitkrgupta.dev) (discussion with google search AI)

Various discussions with Google Search AI regarding site  Free Browser Tool are as below: site free-browser-tools.mohitkrgupta.dev what doe...