Home >Backend Development >C++ >How Do I Enable C 17 Support in Visual Studio Code?
Enabling C 17 Support in Visual Studio Code C Extension
Problem:
In Visual Studio Code (VSCode), developers may encounter errors when using C 17 features like std::string_view. Despite successfully building the code, the editor throws error squiggles, suggesting a lack of C 17 support.
Solution:
To resolve this issue and enable C 17 support:
In VSCode:
For the Debugger:
In the "tasks.json" file, ensure the following lines are present:
{ ... "tasks": [ { ... "args": [ "-std=c++17", "-I", "${fileDirname}", "-g", "${fileDirname}/*.cpp", "-o", "${workspaceFolder}/out/${fileBasenameNoExtension}.o" ], ... "defines": ["_GLIBCXX_USE_CXX11_ABI=0"] ... } ] ... }
Note: Ensure that a folder named "out" exists in your workspace root.
By following these steps, you can effectively enable C 17 support in VSCode and ensure that both the editor and debugger use the correct C version, eliminating error squiggles and allowing for seamless development with C 17 features.
The above is the detailed content of How Do I Enable C 17 Support in Visual Studio Code?. For more information, please follow other related articles on the PHP Chinese website!