注意:工程的路径中不能包括中文字符
{ // 该文件无需更改
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"intelliSenseMode": "msvc-x64",
"browse": {
"path": [
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
],
"version": 4
}
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"preLaunchTask": "Build",
"type": "cppdbg",
"request": "launch",
"targetArchitecture": "x86_64",
"program": "${fileDirname}/${fileBasenameNoExtension}.exe",
"miDebuggerPath": "c:\\MinGW\\bin\\gdb.exe", // 这是环境中gdb.exe的路径
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build",
"type": "shell",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
},
"windows": {
"command": "gcc",
"args": [
"-g", // 参数-g 可以使断点有效,输出异常信息,便于调试
// 这是项目下的多个.c文件,如果项目主函数中调用了多个.c文件中的接口,则要显式的加在这里
"${fileDirname}\\read_csv.c","${fileDirname}\\convert_to_csv.c",
"\"${file}\"", // 这是主函数所在的.c文件
"-I", "${fileDirname}" , // 参数-I 和工程路径 指明了项目中要引用的非标准头文件的位置
"--std=c99", // 以c99标准编译 否则可能会报错
"-o",
"\"${fileDirname}\\${fileBasenameNoExtension}.exe\""
]
},
"group":{
"kind": "build",
"isDefault": true
}
}
]
}