如何讓vscode C++ 終端不再顯示調試啟動信息


按照微軟的官方文檔(https://go.microsoft.com/fwlink/?LinkID=533484#vscode)配置好C++環境之后。

每次按F5都會在終端輸出,但是會附加一串信息。例如:

hello world
[1] + Done                       "/usr/bin/gdb" --interpreter=mi --tty=${DbgTerm} 0<"/tmp/Microsoft-MIEngine-In-tih6ti0q.cz0" 1>"/tmp/Microsoft-MIEngine-Out-s6ibdwj6.pwh"

實際上這些信息是我們發送到gdb的命令,以允許終端使用VS Code。

更確切的說

"The text you are seeing is the command we need to send to gdb to redirect its stdin/stdout/stderr so that we can communicate with it from the debug adapter. In changing to allow integratedTerminal, we also chose to allow VS Code to handle all the terminal launching for external console too due to a request by the community to support more than just xTerm and gnomeTerminal."

解決方案是在launch.json中添加:

"miDebuggerArgs": "-q -ex quit; wait() { fg >/dev/null; }; /bin/gdb -q --interpreter=mi"

參考github之vscode項目issue地址:

https://github.com/microsoft/vscode-cpptools/issues/3298


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM