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!