vscode gcc debug dbg gdb c cpp c++ cuckoo monitor
生活随笔
收集整理的這篇文章主要介紹了
vscode gcc debug dbg gdb c cpp c++ cuckoo monitor
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
為什么80%的碼農(nóng)都做不了架構(gòu)師?>>> ??
裝cygwin 或者mingGW,裝gcc工具鏈,并將cygwin的bin目錄加入環(huán)境變量PATH中。
ctrl+shift+b
{// See https://go.microsoft.com/fwlink/?LinkId=733558// for the documentation about the tasks.json format"version": "2.0.0","tasks": [{"label": "gcc","command": "g++","args": ["-g ${file}", //指定編譯源代碼文件 "-o ${fileDirname}/${fileBasenameNoExtension}.exe", // 指定輸出文件名,不加該參數(shù)則默認(rèn)輸出a.exe"-ggdb3", // 生成和調(diào)試有關(guān)的信息"-Wall", // 開啟額外警告"-static-libgcc", // 靜態(tài)鏈接"-std=c++17", // 使用最新的c++17標(biāo)準(zhǔn)"-Wno-format","-finput-charset=UTF-8",//輸入編譯器文本編碼 默認(rèn)為UTF-8"-fexec-charset=GBK"//編譯器輸出文本編碼 自行選擇],"type": "shell","group": {"kind": "build","isDefault": true},"presentation": {"echo": true,"reveal": "always", // 在“終端”中顯示編譯信息的策略,可以為always,silent,never"focus": false,"panel": "shared" // 不同的文件的編譯信息共享一個(gè)終端面板},"problemMatcher": {"owner": "cpp","fileLocation": ["relative", "\\"],"pattern": {"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$","file": 1,"line": 2,"column": 3,"severity": 4,"message": 5}}}] }launch.json
{// 使用 IntelliSense 了解相關(guān)屬性。 // 懸停以查看現(xiàn)有屬性的描述。// 欲了解更多信息,請?jiān)L問: https://go.microsoft.com/fwlink/?linkid=830387"version": "0.2.0","configurations": [{"name": "(gdb) Launch","type": "cppdbg","request": "launch",//"program": "${file}.exe","program": "${fileDirname}/${fileBasenameNoExtension}.exe","args": [],"stopAtEntry": false,//"cwd": "${workspaceFolder}","cwd": "${fileDirname}","environment": [],"externalConsole": true,"MIMode": "gdb","miDebuggerPath": "gdb.exe","preLaunchTask": "gcc","windows": {"setupCommands": [{"description": "Enable pretty-printing for gdb","text": "-enable-pretty-printing","ignoreFailures": true}]}}] }?
cuckoo的配置如下,其中參數(shù)是從makefile里面提取出來的。
{// See https://go.microsoft.com/fwlink/?LinkId=733558// for the documentation about the tasks.json format"version": "2.0.0","tasks": [{"label": "echo","type": "shell","command": "i686-w64-mingw32-gcc","args": ["-m32 -Wall -Wextra -std=c99 -static -Wno-missing-field-initializers -I inc/ -I objects/code/ -I src/bson/ -I src/sha1/", //-mwindows//最后一個(gè)參數(shù) -mwindows加上后輸出只能出現(xiàn)在cygwin環(huán)境,而不會(huì)出現(xiàn)在dos環(huán)境"-g","${file}","-o","${workspaceRoot}/test.exe"],"group": {"kind": "build","isDefault": true}}] }?
完整版配置環(huán)境:
task.json
{// See https://go.microsoft.com/fwlink/?LinkId=733558// for the documentation about the tasks.json format"version": "2.0.0","tasks": [{"label": "mingw32","command": "i686-w64-mingw32-gcc","args": ["-m32 -Wall -Wextra -std=c99 -static -Wno-missing-field-initializers -I inc/ -I objects/code/ -I src/bson/ -I src/sha1/","-g ${file}", //指定編譯源代碼文件 "-o ${fileDirname}/${fileBasenameNoExtension}.exe", // 指定輸出文件名,不加該參數(shù)則默認(rèn)輸出a.exe"-ggdb3", // 生成和調(diào)試有關(guān)的信息"-Wall", // 開啟額外警告"-static-libgcc", // 靜態(tài)鏈接// "-std=c++17", // 使用最新的c++17標(biāo)準(zhǔn)"-Wno-format","-finput-charset=UTF-8",//輸入編譯器文本編碼 默認(rèn)為UTF-8"-fexec-charset=GBK"//編譯器輸出文本編碼 自行選擇],"type": "shell","group": {"kind": "build","isDefault": true},"presentation": {"echo": true,"reveal": "always", // 在“終端”中顯示編譯信息的策略,可以為always,silent,never"focus": false,"panel": "shared" // 不同的文件的編譯信息共享一個(gè)終端面板},"problemMatcher": {"owner": "cpp","fileLocation": ["relative", "\\"],"pattern": {"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$","file": 1,"line": 2,"column": 3,"severity": 4,"message": 5}}},{"label": "gcc","command": "g++","args": ["-g ${file}", //指定編譯源代碼文件 "-o ${fileDirname}/${fileBasenameNoExtension}.exe", // 指定輸出文件名,不加該參數(shù)則默認(rèn)輸出a.exe"-ggdb3", // 生成和調(diào)試有關(guān)的信息"-Wall", // 開啟額外警告"-static-libgcc", // 靜態(tài)鏈接"-std=c++17", // 使用最新的c++17標(biāo)準(zhǔn)"-Wno-format","-finput-charset=UTF-8",//輸入編譯器文本編碼 默認(rèn)為UTF-8"-fexec-charset=GBK"//編譯器輸出文本編碼 自行選擇],"type": "shell","group": {"kind": "build","isDefault": true},"presentation": {"echo": true,"reveal": "always", // 在“終端”中顯示編譯信息的策略,可以為always,silent,never"focus": false,"panel": "shared" // 不同的文件的編譯信息共享一個(gè)終端面板},"problemMatcher": {"owner": "cpp","fileLocation": ["relative", "\\"],"pattern": {"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$","file": 1,"line": 2,"column": 3,"severity": 4,"message": 5}}}] }launch.json
{// 使用 IntelliSense 了解相關(guān)屬性。 // 懸停以查看現(xiàn)有屬性的描述。// 欲了解更多信息,請?jiān)L問: https://go.microsoft.com/fwlink/?linkid=830387"version": "0.2.0","configurations": [{"name": "mingw32","type": "cppdbg","request": "launch",//"program": "${file}.exe","program": "${fileDirname}/${fileBasenameNoExtension}.exe","args": [],"stopAtEntry": false,//"cwd": "${workspaceFolder}","cwd": "${fileDirname}","environment": [],"externalConsole": true,"MIMode": "gdb","miDebuggerPath": "gdb.exe","preLaunchTask": "mingw32","windows": {"setupCommands": [{"description": "Enable pretty-printing for gdb","text": "-enable-pretty-printing","ignoreFailures": true}]}},{"name": "(gdb) Launch","type": "cppdbg","request": "launch",//"program": "${file}.exe","program": "${fileDirname}/${fileBasenameNoExtension}.exe","args": [],"stopAtEntry": false,//"cwd": "${workspaceFolder}","cwd": "${fileDirname}","environment": [],"externalConsole": true,"MIMode": "gdb","miDebuggerPath": "gdb.exe","preLaunchTask": "gcc","windows": {"setupCommands": [{"description": "Enable pretty-printing for gdb","text": "-enable-pretty-printing","ignoreFailures": true}]}}] }?
?
?
參考:
VSCode下C++環(huán)境的配置
http://blog.csdn.net/feynman1999/article/details/79437524
轉(zhuǎn)載于:https://my.oschina.net/u/1777508/blog/1635057
總結(jié)
以上是生活随笔為你收集整理的vscode gcc debug dbg gdb c cpp c++ cuckoo monitor的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: JavaWeb应用配置文件安全解决方案
- 下一篇: ios 获取控件高度