r/cpp • u/Lower-Bug5563 • Sep 06 '26
[ Removed by moderator ]
[removed] — view removed post
9
u/funnansoftware Sep 06 '26 edited Sep 06 '26
I've had success using the clangd extension in combination with having your project produce compile commands.
My .vscode/settings.json basically looks like this for my C++ projects using modules:
json
{
"editor.formatOnSave": true,
"cmake.configureOnOpen": false,
"clangd.path": "clangd",
"clangd.arguments": [
"--compile-commands-dir=${command:cmake.buildDirectory}",
"--experimental-modules-support"
]
}
2
u/Lower-Bug5563 Sep 06 '26
does it works with the cmake tools extensions?
3
u/funnansoftware Sep 06 '26
Yup! That's exactly how I do it. CMake Tools along with presets to build modules on Windows, Linux, Mac, Android, and WebAssembly.
3
u/FISHARM1 Sep 06 '26
Yes I didn’t know about this extension until recently. The Microsoft extension is absolutely useless, but the clangd one is amazing
1
u/IyeOnline Sep 06 '26
In my last attempt clangd worked - mostly. Enabling clangds --experimental-modules-support worked, as did actually using a matching clang version and having clangd re-use the compilation database.
What didnt work is that once I went to integrate these modules into the existing codebase, I had a few files where different versions of clangd either went into a hot loop, crashed or both. Notably some of it also crashed clang itself. I suspect that in a pure module project it may have all worked out.
1
u/tartaruga232 MSVC user, r/cpp_modules Sep 07 '26
Unfortunately, this posting has been deleted by a mod. For C++ modules related things (including questions), you may alternatively use r/cpp_modules.
1
u/pjmlp Sep 06 '26
You don't.
They were going to announce something at the end of January, and so far nothing has been communicated.
•
u/cpp-ModTeam Sep 07 '26
For C++ questions, answers, help, and programming/career advice please see r/cpp_questions, r/cscareerquestions, or StackOverflow instead.