I did a very simple app that works when I build and run it from the terminal by:
g++ -std=c++14 helloworld.cpp
./a.out
Now I'm trying to configure the Visual Studio Code to debug this app. I did:
- Settings -> search for "cppStandard" -> changed to c++14 for both User & Workspace
- Add Debug configuration -> C/C++: g++ build and debug active file
- Select -> Debug C/C++ file.
error showing:
'function\<void ()\>' is deprecated: Using std::function in C++03 is not supported anymore. Please upgrade to C++11 or later, or use a different type \[-Wdeprecated-declarations\]
The IDE also marks the code:
std::function<void()> func = []() { std::cout << "From Thread ID : "<<std::this_thread::get_id() << "\n"; };
as an error, showing:
class std::__1::function<void ()> 'function<void ()>' is deprecated: Using std::function in C++03 is not supported anymore. Please upgrade to C++11 or later, or use a different type [-Wdeprecated-declarations]gcc
Edited: I'm using macOS Ventura with apple silicon. I have added c_cpp_properties.json (by: Control+Shift+P -> c/c++ edit configuration).
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"macFrameworkPath": [
"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
],
"compilerPath": "/usr/bin/clang",
"intelliSenseMode": "macos-clang-arm64",
"cppStandard": "c++14"
}
],
"version": 4
}
I still get the same error about C++03 not compatible with my code, Any suggestions?