Home > Backend Development > C++ > How to Correctly Configure VS Code for C 14/C 17 Compilation?

How to Correctly Configure VS Code for C 14/C 17 Compilation?

Barbara Streisand
Release: 2024-12-15 13:19:14
Original
986 people have browsed it

How to Correctly Configure VS Code for C  14/C  17 Compilation?

Setting VS Code for C 14 / C 17

Problem:

When running a .cpp file from the workspace, users may encounter errors indicating the lack of C 11/higher flags. Despite adding these flags to task.json, the issue persists.

Solution:

Modify the settings.json file as follows to resolve the problem:

"code-runner.executorMap": {
    "cpp": "cd $dir && g++ -std=c++17 $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
},
Copy after login

This change should allow the code to run without any errors related to C 14 or 17.

The above is the detailed content of How to Correctly Configure VS Code for C 14/C 17 Compilation?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template