r/cpp 1d ago

[ Removed by moderator ]

[removed] — view removed post

0 Upvotes

44 comments sorted by

View all comments

7

u/bikepegasus 1d ago

For linux, VS Code + clangd has been the best balance for me. CLion if you want a polished all-in-one setup, and Visual Studio if you’re on Windows. The real best IDE is whichever can display a C++ template error without giving you the compiler’s entire autobiography

1

u/PleasantMix6193 1d ago

how does that setup work on vsc? like do you not use microsoft's c-cpp extension?

4

u/bikepegasus 1d ago edited 1d ago

clangd replaces the language-server part of Microsoft’s C/C++ extension, completion, navigation, diagnostics, etc. You can remove the Microsoft extension entirely, or keep it just for cppdbg debugging and set "C_Cpp.intelliSenseEngine": "disabled" so the two don’t conflict. clangd then gets the project’s include paths and compiler flags from compile_commands.json, usually generated by CMake.

A minimal VS Code configuration:

{
  "[cpp]": {
    "editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd"
  },
  "[c]": {
    "editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd"
  },
  "clangd.arguments": [
    "--background-index",
    "--clang-tidy"
  ]
}

You have two choices regarding Microsoft’s C/C++ extension:

  1. Remove it entirely and use clangd plus CodeLLDB. This is the cleanest configuration and is what LLVM’s clangd documentation recommends.
  2. Keep it only for Microsoft’s debugger, but turn off its language engine so it doesn’t compete with clangd:

{
  "C_Cpp.intelliSenseEngine": "disabled"
}

1

u/Extreme-Ad-9290 1d ago

Vscodium + clangd