Configure emacs as c/cpp ide

1. install company, lsp-mode, flycheck, lsp-ui

2. install clangd in ubuntu, then M-x customize-group RET lsp-clangd give clandg file paths, etc

2. In project folder create file .dir-locals.el (refer following link https://blog.mohitkrgupta.dev/2024/08/how-to-configure-dir-localsel-file-for.html)

((nil . ((eval . (progn

   (require 'lsp-mode)

   (lsp-deferred)

   ;;(hs-minor-mode t)

   (flycheck-mode t)

   (global-ede-mode t))))))

3. In project folder create .clangd file:

CompileFlags:

  Add: ["-I/usr/include/postgresql","-I/usr/include/postgresql/17/server","-I/usr/include/glib-2.0","-I/usr/lib/x86_64-linux-gnu/glib-2.0/include"]

---

If:

  PathMatch: .*\.hpp

CompileFlags:

  Add: ["-std=c++23"]

---

If:

  PathMatch: .*\.cpp

CompileFlags:

  Add: ["-std=c++23"]

---

If:

  PathMatch: .*\.h

CompileFlags:

  Add: [-std=gnu18, -Wall, -Wextra, -Wno-nested-functions]

---

If:

  PathMatch: .*\.c

CompileFlags:

  Add: [-std=gnu18, -Wall, -Wextra, -Wno-nested-functions]

---



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...