重慶分公司,新征程啟航
為企業提供網站建設、域名注冊、服務器等服務
為企業提供網站建設、域名注冊、服務器等服務
關于窗口閃退問題可以在程序中添加:
#includesystem("pause");
當然也可以在.vscode文件中的配置文件中進行一些修改以解決此問題:
在launch.json中"configurations"下面進行修改:
"program": "C:\\Windows\\System32\\cmd.exe",
"args": ["/c","${fileDirname}\\${fileBasenameNoExtension}.exe","&","pause"],
可以直接賦值下面的然后粘貼到你的launch.json中:
{
// 使用 IntelliSense 了解相關屬性。
// 懸停以查看現有屬性的描述。
// 欲了解更多信息,請訪問: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "gcc.exe - 生成和調試活動文件",
"type": "cppdbg",
"request": "launch",
"program": "C:\\Windows\\System32\\cmd.exe",
"args": ["/c","${fileDirname}\\${fileBasenameNoExtension}.exe","&","pause"],
// "program":"${fileDirname}\\${fileBasenameNoExtension}.exe",
// "args":[],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "C:\\mingw64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "為 gdb 啟用整齊打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "將反匯編風格設置為 Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: gcc.exe 生成活動文件"
}
]
}
上面涉及到路徑的地方要改為自己的路徑,上面第19行的"true"表示你到使用外部終端,如果要用vscode內部自帶終端的話就改了"false"就好了。
關于中文亂碼需要修改tasks.json
添加上:"-fexec-charset=GBK"
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc.exe 生成活動文件",
"command": "C:\\mingw64\\bin\\gcc.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe",
"-fexec-charset=GBK"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "調試器生成的任務。"
}
],
"version": "2.0.0"
}
如果VSCode還沒安裝的話,關于VSCode的下載安裝也很簡單:Visual Studio Code - Code Editing. Redefined
此外還需下載MinGW:
MinGW - Minimalist GNU for Windows download | SourceForge.net
MinGW官網:MinGW-w64
在官網中點擊“Downloads"-->"SourceForge"?
你是否還在尋找穩定的海外服務器提供商?創新互聯www.cdcxhl.cn海外機房具備T級流量清洗系統配攻擊溯源,準確流量調度確保服務器高可用性,企業級服務器適合批量采購,新人活動首月15元起,快前往官網查看詳情吧