问题描述
我在我的 windows7 上安装了 VSCode 和 MinGW-W64 并且想要运行 c/c++ 代码。但是在运行 hello 程序后,我发现它无法进入调试模式。下面是我从教程中复制的代码:
hello.cpp:
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
vector<string> msg {"Hello","C++","World","from","VS Code","and the C++ extension!"};
for (const string& word : msg)
{
cout << word << " ";
}
cout << endl;
}
launch.jason:
{
"version": "0.2.0","configurations": [
{
"name": "C/C++: g++.exe build active file","type": "cppdbg","request": "launch","program": "${fileDirname}\\${fileBasenameNoExtension}.exe","stopAtEntry": false,"customLaunchSetupCommands": [
{ "text": "target-run","description": "run target","ignoreFailures": false }
],"launchCompleteCommand": "exec-run","linux": {
"MIMode": "gdb","miDebuggerPath": "/usr/bin/gdb"
},"osx": {
"MIMode": "lldb"
},"windows": {
"MIMode": "gdb","miDebuggerPath": "E:\\Program Files (x86)\\MingGW\\mingw64\\bin\\gdb.exe"
}
}
]
}
task.jason:
{
"version": "2.0.0","tasks": [
{
"type": "shell","label": "C/C++: g++.exe build active file","command": "g++","args": ["-g","${file}","-o","${fileDirname}\\${fileBasenameNoExtension}.exe"],"options": {
"cwd": "${workspaceFolder}"
},"problemmatcher": ["$gcc"],"group": {
"kind": "build","isDefault": true
}
}
]
}
我只在 vscode 中安装 c/c++ 扩展。安装时有什么我想念的吗?还是 VSCode 在 windows7 下能正常工作?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)