命令。使用 VSCode 编译 C 文件时出现 exe 错误 + win环境下的Clang
我编写了一个名为 helloengine_win.c
的新 .c 文件,并使用快捷键 shift + ctrl + b
来编译它。 tasks.json
是:
{
"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\""
}
]
}
该文件使用 GetStockObject()
所以我需要 lib User32.Lib
和 Gdi32.lib< /code>
但是当我编译文件时我得到: spawn C:\Windows\system32\cmd.exe ENOENT 生成已完成,但发生错误
我已经确认所有库文件都存在,并且文档中没有报告任何错误。我不知道是什么错误的。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论