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.

Various types of salts effect on health (discussion with gemenie)

Is  rock salt or bitnoon helps in digestion or just a airuvedic nuska This is for informational purposes only. For medical advice or diagnos...