I have a including problems when trying to use clangd.
Heres the latest i've tried:
--compile-commands-dir...
-j=6
F1 + clangd: Restart language server
I've tested it with these: Test main.cpp:
#include <iostream>
int main() {
std::cout << "IT WORKS\n";
return 0;
}
Test CMakeList.txt:
cmake_minimum_required(VERSION 3.1)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project(test)
add_executable(
${PROJECT_NAME}
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
)
Which I have initialized with mkdir build && cd build && cmake ../ && make && ./test
The program does the "IT WORKS" cout in the terminal right but VS Code is showing clang errors with <iostream>
and std
for not recognizing them.
Found this from another stack overflow post and it did the trick:
"I spoke to a colleague who told me that gcc-12 was included in ubuntu 22.04 an created some mess with clang. To solve the issue, I did
sudo apt install g++-12
and now it works well."