Recently I wanted to use a compile_flags.txt-file to allow development in C++20
. Clangd shows annoying warnings when using structured-bindings and C++-related features and so I created this file.
My compile_flags.txt
-file looks like this:
-std=c++20
When I want to edit a C-file however, clangd complains for the basic include directive: #include <stdio.h>
:
clang[drv_argument_not_allowed_with]: Invalid argument '-std=c++20' not allowed with 'C'.
Naturally, I removed the compile_flags.txt
-file and it works fine.
How can I achieve writing C++20-code and C-code at the same time without manually removing the file every time I decide to switch between the two? Thanks for any help in advance :^)