簡體   English   中英

如何將 Sublime Text 中的錯誤消息重定向到文件

[英]How to redirect error message in Sublime Text to a file

我正在使用 sublime 在 C++ 中編寫代碼。 我使用以下構建系統來執行我的代碼,它工作正常。

{
"cmd": ["g++.exe","-std=c++17", "${file}", "-o", "${file_base_name}.exe", "&&" , "${file_base_name}.exe<input.txt>output.txt"],
"selector":"source.cpp",
"shell":true,
"working_dir":"$file_path"
}

但是,如果出現分段錯誤,我不會在控制台中顯示任何錯誤消息。 有沒有辦法像輸出一樣重定向文件中的所有錯誤消息,比如“error.txt”。

以下應該將 STDERR 重定向到error.txt 2>是要使用的正確 shell 重定向器。

{
    "cmd": ["g++.exe","-std=c++17", "${file}", "-o", "${file_base_name}.exe", "&&" , "${file_base_name}.exe<input.txt>output.txt2>error.txt"],
    "selector": "source.cpp",
    "shell": true,
    "working_dir": "$file_path"
}

請參閱此處以獲取解釋。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM