Skip to content

C++20 consteval not recognized / Executable not updating despite correct tasks.json in VS Code #257832

@waghmadhulika-droid

Description

@waghmadhulika-droid

Type: Bug

Problem Description:

I am experiencing persistent issues with my C++ development environment in Visual Studio Code, specifically related to compiler standard recognition and executable updates.

consteval Keyword Not Recognized:

Initially, C++20 features like consteval were not recognized by the compiler, resulting in errors like "this declaration has no storage class or type specifier".

This occurred even when the tasks.json file was configured to use -std=c++20 for g++.exe.

Executable Not Updating/Running Correctly:

Even after successfully configuring tasks.json and seeing "Build finished successfully" in the VS Code terminal, the generated .exe file (e.g., rooster.exe) frequently does not reflect the latest code changes.

When I run the executable (e.g., .\rooster.exe), it often executes a previous version of the code, displaying old output, rather than the expected output from the most recently compiled source.

Troubleshooting Steps Already Taken:

tasks.json verified: Confirmed that -std=c++20 is correctly set in tasks.json for the g++.exe build task.

Explicit Build Task Execution: Always explicitly selected the "Build with GCC 14.2.0" task.

Source File Verification: Ensured the correct .cpp file is being compiled.

Typo Correction: All code typos (e.g., std::end1 to std::endl) have been corrected.

Manual Executable Deletion: Tried manually deleting the .exe file (del rooster.exe) before rebuilding.

Unique Executable Name: Attempted compiling to a new, unique .exe filename to bypass potential file locking.

Manual Compilation: Attempted compiling directly from the VS Code integrated terminal using the exact g++.exe command from tasks.json.

VS Code Restart: Restarted VS Code multiple times.

C/C++ Extension Settings: Checked "C/C++: Edit Configurations (UI)" to ensure C++ Standard is set to "C++20" and compiler path is correct.

Environment Details:

VS Code Version: (You can find this in Help -> About)

C/C++ Extension Version: (Go to Extensions, search for C/C++, click on it, version is listed)

Operating System: Windows 11

Compiler Used: g++.exe from winlibs-x86_64-posix-seh-gcc-15.1.0-mingw-w64ucrt-13.0.0-r2\mingw64\bin\g++.exe (GCC 14.2.0)

tasks.json Snippet: {
"type": "cppbuild",
"label": "Build with GCC 14.2.0",
"command": "C:\Users\waghm\Downloads\winlibs-x86_64-posix-seh-gcc-15.1.0-mingw-w64ucrt-13.0.0-r2\mingw64\bin\g++.exe",
"args": [
"-g",
"-std=c++20",
"${workspaceFolder}\*.cpp", // Or "${workspaceFolder}\main.cpp" if you changed it
"-o",
"${fileDirname}\my_new_app.exe" // Or "rooster.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: C:\Users\waghm\Downloads\winlibs-x86_64-posix-seh-gcc-15.1.0-mingw-w64ucrt-13.0.0-r2\mingw64\bin\g++.exe"
}

VS Code version: Code 1.102.2 (c306e94, 2025-07-22T12:15:48.520Z)
OS version: Windows_NT x64 10.0.26100
Modes:

System Info
Item Value
CPUs 13th Gen Intel(R) Core(TM) i5-13420H (12 x 2611)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 15.65GB (5.87GB free)
Process Argv --crash-reporter-id 6dea24cd-1f1b-4ec7-8ef5-0e9c88075ce8
Screen Reader no
VM 0%
Extensions (7)
Extension Author (truncated) Version
debugpy ms- 2025.10.0
python ms- 2025.10.1
vscode-pylance ms- 2025.7.1
vscode-python-envs ms- 1.0.0
cmake-tools ms- 1.21.36
cpptools ms- 1.26.3
cpptools-extension-pack ms- 1.3.1

(1 theme extensions excluded)

A/B Experiments
vsliv368:30146709
vswsl492:30256859
binariesv615:30325510
h48ei257:31000450
nativeloc1:31344060
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
hdaa2157:31222309
copilot_t_ci:31333650
e5gg6876:31282496
pythoneinst12:31285622
c7cif404:31314491
pythonpulldiag:31343502
996jf627:31283433
pythonrdcb7:31342333
usemplatestapi:31297334
0aa6g176:31307128
747dc170:31275177
aj953862:31281341
generatesymbolt:31295002
convertfstringf:31295003
pylancequickfixt:31350061
9d2cg352:31346308
convertlamdaf:31350062
usemarketplace:31343026
nesew2to5:31336538
agentclaude:31352135
nes-diff-11:31337487
replacestringexc:31350595
nes-set-on:31351930
6abeh943:31336334
envsactivate1:31353494
yijiwantestdri0626-t:31336930
0927b901:31350571
ji9b5146:31348712
0cj2b977:31352657

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions