Colin's Blog

Recent content on Colin's Blog

马上订阅 Colin's Blog RSS 更新: https://blog.oyyko.com/index.xml

Using Cpp17 or higher version of Cpp on Vscode extension Clangd

finalwind42@gmail.com (Oyyko)
2022年8月7日 21:49

Recently I’ve switched my code completion tool in VScode from Microsoft’s official plugin to clangd. On the one hand, clangd can provide a better user experience, on the other hand, I also use this plugin in my company (Bytedance).

I joked to myself: Two of the most interesting things I learned when I interned at the company were that indentation changed from four spaces to two, and braces changed from wrap to no wrap.

Now, there is a problem. I installed clangd, switched over and everything worked fine. But when I use string_view, clangd told me it didn’t recognize this thing. I quickly realized that this is due to the fact that the default Cpp version of clangd is still 14. So changing its default version became something I had to do.

I googled but didn’t find any useful information.

I try to use compile_commands.json file. But on the one hand, it needs to be configured separately for each project, while the effect I expect is to use Cpp17 for any file that is opened at random. On the other hand, it turns out that it does not work. (maybe I didn’t configure it properly)

So, here is the final...

剩余内容已隐藏

查看完整文章以阅读更多