'Cmd. exe error occurred when compiling C file with VSCode + Clang in win environment

I write a new .c file named helloengine_win.c and use shortcuts shift + ctrl + b to complier it. The tasks.json is :

{
"version": "2.0.0",
"tasks": [
    {
        "type": "cppbuild",
        "label": "C/C++: clang.exe",
        "command": "D:\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\Llvm\\x64\\bin\\clang.exe",
        "args": [
            "-fdiagnostics-color=always",
            "-g",
            "${file}",
            "-o",
            "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "-L",
            "C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.19041.0\\um\\x64\\User32.Lib",
            "C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.19041.0\\um\\x64\\Gdi32.Lib"
        ],
        "options": {
            "cwd": "D:\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\Llvm\\x64\\**"
            
        },
        "problemMatcher": [
            "$gcc"
        ],
        "group": {
            "kind": "build",
            "isDefault": true
        },
        "detail": "\"D:\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\Llvm\\x64\\bin\\clang.exe\""
    }
]

}

The file uses GetStockObject() so I need the lib User32.Lib and Gdi32.lib

But when I complier the file I get : spawn C:\Windows\system32\cmd.exe ENOENT generation is complete, but an error occurred

I have confirmed that all library files exist and no errors are reported in the documentation.I don't konw what's wrong.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source