打开task.json,把func.c的文件添加到编译选项中,task.json内容如下:
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc.exe 生成活动文件",
"command": "D:\\mingw64\\bin\\gcc.exe",
"args": [
"-g",
"${file}",
"${fileDirname}\\func.c", //添加这一行就够了,即为了让编译器找到对应的.c文件,如果有其他.c文件,继续按照这种方式添加就可以了
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "调试器生成的任务。"
}
],
"version": "2.0.0"
}