c_cpp_properties.json文件:
注:XXXXXX 代表的是文件路径中文件夹的名字
{
"configurations": [
{
"name": "Win32",
"includePath": [
"D:\\XXXXXX\\XXXXXX\\Dev-Cpp\\MinGW64\\lib\\gcc\\x86_64-w64-mingw32\\4.9.2\\include",
"D:\\XXXXXX\\XXXXXX\\Dev-Cpp\\MinGW64\\include",
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "D:\\5_360Downloads\\360Downloads\\Dev-Cpp\\MinGW64\\bin\\g++.exe",
"cStandard": "c11",
"cppStandard": "gnu++14",
"intelliSenseMode": "gcc-x64",
"browse": {
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
],
"version": 4
}
launch.json文件中:
注:XXXXX代表文件路径中的文件夹名字
{
"version": "0.2.0",
"configurations": [
{
"name": "g++.exe - 生成和调试活动文件",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true, //false
"MIMode": "gdb",
"miDebuggerPath": "D:\\XXXXX\\XXXXX\\Dev-Cpp\\MinGW64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "g++"
}
]
}
settings.json文件中:
{
"files.associations": {
"ostream": "cpp",
"iostream": "cpp"
},
"C_Cpp.errorSquiggles": "Disabled"
}
tasks.json文件中:
{
"version": "2.0.0",
"tasks": [
{
//"label": "build",
"label": "g++", //修改此项
"type": "shell",
//"command": "msbuild",
"command":"g++.exe",
/*"args": [
// Ask msbuild to generate full paths for file names.
"/property:GenerateFullPaths=true",
"/t:build",
// Do not generate summary otherwise it leads to duplicate errors in Problems panel
"/consoleloggerparameters:NoSummary"
],*/
"args": [
"-g",
//"${workspaceFolder}/include/*.cpp", //要包含所有需要执行的cpp,包含自定义头文件对应的cpp(好像没什么影响,将头文件放在当前目录就行)
"-fexec-charset=GBK",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}.exe",
"-Wall",
"-static-libgcc"
],
"group": "build",
"presentation": {
// Reveal the output only if unrecognized errors occur.
"reveal": "silent"
},
// Use the standard MS compiler pattern to detect errors, warnings and infos
"problemMatcher": "$msCompile"
}
]
}
测试结果:
?
|