1

[急求] VSCode 调试 C++ 如何实现输入重定向

 1 year ago
source link: https://www.v2ex.com/t/910472
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  程序员

[急求] VSCode 调试 C++ 如何实现输入重定向

  leverestfish · 4 小时 5 分钟前 · 378 次点击

明天要考试了,紧急来问一下:

  • 实现输入重定向(类似于 CLion 那样)

    • 经过测试发现 launch.json 里面 args 字段添加两个参数的方法 < test.input 是不行的
  • 使用场景限制,必须要用 VSCode

  • 只使用 Microsoft 官方的那个 C/C++ 插件

  • 编译通过运行 Makefile 手动执行

  • 另外,在 macOS 上如果 debug 选择 external terminal 为 false 时( VS Code 内置的 terminal )似乎是完全没办法进行手动输入,其他操作系统不清楚

搜遍全网似乎没看到好的方案,不理解为什么 VSCode 在 C++ 有输入的情况下调试这方面支持做的这么差,如果有完整的使用 VSCode 优雅调试 C++ 的文档请分享一下~

提前感谢各位大佬!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK