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
Barbara StreisandOriginal
2024-12-15 13:19:14984browse

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",
},

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!

Statement:
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