我一直在搜索整個互聯網,但找不到使用 clang 編譯器構建我的 c 專案的解決方案。我對所有這些東西都很陌生,很抱歉造成誤解。我有默認tasks.json檔案:
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "clang build active file",
"command": "C:/Program Files/LLVM/bin/clang ",
"args": [
"-std=c 17",
"-stdlib=libc ",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
我可以編譯,這就是我編譯的,3個檔案:

我需要以某種方式創建可執行檔案...感謝您的幫助。
uj5u.com熱心網友回復:
如果您閱讀了檔案(它適用于 MinGW,但它與 Clang for Windows 完全相同),您需要顯式地將.exe后綴添加到輸出檔案中。
因此,您的“可執行”檔案是名為 的檔案main,沒有任何后綴或“擴展名”。
您需要更改tasks.json檔案以添加.exe后綴:
"${fileDirname}/${fileBasenameNoExtension}.exe"
# Note the suffix here -------------------^^^^
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/528399.html
