LoginSignup
4
2

More than 3 years have passed since last update.

VScodeでLLDBでC++をデバッグするときファイルをリダイレクトする方法

Posted at

背景

vscodeでC++のデバッグをするとき、ファイルをリダイレクトしたいと思った。launch.jsonのデバッグのタスクを作る時、argsのところに[">", "input.txt"]としたがリダイレクトできなかった。

フォルダ構成

/src
-  target.cpp
-  input.text

解決策

launch.jsonでデバッグのタスクの"configurations"に

launch.json
"setupCommands": [
                {
                    "text": "settings set target.input-path ${fileDirname}/input.txt"
                }
]

を追加する。

参考記事

Cannot get lldb to read file input - stack overflow
VS Code lldb debugging with stdin

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2