Quantcast
Channel: Active questions tagged windows-subsystem-for-linux - Ask Ubuntu
Viewing all articles
Browse latest Browse all 2827

VS Code in WSL Fails to Find Standard C++ Headers (#include errors) Despite g++ Installation

$
0
0

I am developing C++ code using Visual Studio Code connected to Ubuntu running under WSL 2 on Windows 11.

wsl --version

WSL: 2.4.13.0

Although I have installed the necessary build tools in WSL.

sudo get update

sudo apt-get install build-essential

sudo get update

sudo apt-get install gcc g++

The Problem:

VS Code's C/C++ extension specifically fails to find the standard header file.

In my .cpp files, the line #include <multiset> is underlined with a red squiggle, and hovering shows:

#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit.

cannot open source file "multiset" C/C++(1696)

This doesn't happen for all standard library headers. However, other standard library headers seem to be found correctly.

While other include libreries is fine:

My Setup is WSL:

lsb_release -aNo LSB modules are available.Distributor ID: UbuntuDescription:    Ubuntu 24.04.2 LTSRelease:        24.04Codename:       noble

c_cpp_properties.json:

{"configurations": [        {"name": "Linux","includePath": ["${workspaceFolder}/**"            ],"defines": [],"compilerPath": "/usr/bin/g++","cStandard": "c17","cppStandard": "gnu++17","intelliSenseMode": "linux-gcc-x64"        }    ],"version": 4}

What i tried:Reinstalling gcc and g++:

sudo apt-get autoremove g++ gcc

sudo apt-get install gcc g++

sudo apt-get install g++-multilib

I don't know why this specific #include <multiset> is not found. I can't find an answer. Btw, I used google translator to write this question.


Viewing all articles
Browse latest Browse all 2827

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>