今年初按网上教程配置的运行环境,一直没啥大问题,用着学c primier plus,一直挺舒服的。
前几天发现断点调试的时候,只要一点开查看变量程序窗口就闪退,而这个月一直在学文件输入输出,用的cmd,没注意是什么时候开始的,不知道是不是因为vscode更新了配置文件不匹配啥的。
.vscode文件夹配置如下
c_cpp_properties.json:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "E:\\mingw\\mingw64\\bin\\gcc.exe",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "windows-gcc-x64"
}
],
"version": 4
}
launch.json:
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "g++.exe - 生成和调试活动文件",
"preLaunchTask": "C/C++: g++.exe 生成活动文件",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "E:\\mingw\\mingw64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "C/C++: g++.exe 生成活动文件",
"command": "E:\\mingw\\mingw64\\bin\\g++.exe",
"args": [
"-g",
"${file}",
"-fexec-charset=GBK",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "test",
"isDefault": true
},
"detail": "编译器: E:\\mingw\\mingw64\\bin\\g++.exe"
}
]
}
settings.json
{
"files.associations": {
"string.h": "c"
},
"C_Cpp.errorSquiggles": "Enabled"
}
我也不太懂是不是环境配置的问题,运行情况大概如图所示。只要是断点调试,程序窗口就闪退。运行的c代码是之前用过断点调试的,不会是代码的问题。也试过卸载重装,也没起作用。
求个解决方法。