'Visual Studio Code C/C++ Extension cannot find compiler path

Problem: The program works but the intellisense doesnt recognize the compiler.

Specifications: I use wsl. Installed from powershell

What i've tried: I reinstalled both wsl,gcc and vscode and the c/c++ extension

Some Screenshots:

Gcc location in pc

The actual error

what is causes



Solution 1:[1]

If you are using Windows, GCC installed on your virtual machine is independant of your primary OS. It seems GCC is installed on your VM. On Ubuntu/Linux, use the following commands to install a GCC compiler:

sudo apt update

sudo apt install build-essential

Furthermore, Visual Studio is simply a text editor. If you want to compile and execute C/C++ on VS, the simplest way is to compile via Powershell on Windows provided you have GCC installed.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 thediyer