I'm using VS Code on Windows 10 and have written some C code. In the code, I need to use the sys/wait.h
header. Since that is a Linux-specific header, I need to compile and run with WSL2 using Ubuntu as a subsystem.
The code compiles and works with WSL but VS Code gives me the following error:
#include errors detected. Please update your includePath.
My guess is it's because my current includePath
points to GCC on my Windows machine and not to WSL, which is why it can't find this header. Is there a way for me to also include the headers found in WSL Ubuntu or do I have to live with this annoying error?
To use the WSL/Linux gcc
and Linux headers/libraries from within VSCode::
cd
to your project directory and then start VSCode with code .
.>
<
stacked together. Then select "Open Folder in WSL ...". This is also available from the Command Palette (Shift+Ctrl+P) with "Remote WSL - Open Folder in WSL ..."