I'm using C++ in vscode with Microsoft C/C++ Extension. I'm using g++ compiler provided in msys2:
gcc --version
gcc.exe (Rev6, Built by MSYS2 project) 13.1.0
When I write this code in editor, it shows error squiggles:
*std::ranges::find(myvec, foo1) = foo2;
~~~
no instance of overloaded function "std::ranges::__find_fn::operator()" matches the argument list C/C++(304)
mycode.cpp(122, 3): argument types are: (std::vector<const Foo *, std::allocator<const Foo *>>, const Foo *)
mycode.cpp(122, 3): object type is: const std::ranges::__find_fn
But, when I compile this file with -std=c++23, it compiles properly, even without any warnings.
My C/C++ configuration looks like this:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:/msys64/mingw64/bin/g++.exe",
"compilerArgs": [
"-std=c++23"
],
"intelliSenseMode": "linux-gcc-x64",
"cStandard": "c23",
"cppStandard": "c++23"
}
],
"version": 4
}
How do I resolve these errors?