C++;终端在Visual Studio代码中不工作 我有一个C++程序。这个程序不起作用。我将“externalConsole”:false更改为“externalConsole”:true,它可以工作,它给了我控制台。但是我想使用“externalConsole”:false运行。有办法做到这一点吗?相关产出如下

C++;终端在Visual Studio代码中不工作 我有一个C++程序。这个程序不起作用。我将“externalConsole”:false更改为“externalConsole”:true,它可以工作,它给了我控制台。但是我想使用“externalConsole”:false运行。有办法做到这一点吗?相关产出如下,c++,visual-studio-code,vscode-debugger,C++,Visual Studio Code,Vscode Debugger,计划(asd.cpp) 终点站 Windows PowerShell Try the new cross-platform PowerShell https://aka.ms/pscore6 PS C:\Users\hakan\projects\onecpp> & 'c:\Users\hakan\.vscode\extensions\ms-vscode.cpptools-1.3.0-insiders4\debugAdapters\bin\WindowsDebugLaunche

计划(asd.cpp)

终点站

Windows PowerShell

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\hakan\projects\onecpp>  & 'c:\Users\hakan\.vscode\extensions\ms-vscode.cpptools-1.3.0-insiders4\debugAdapters\bin\WindowsDebugLauncher.exe' '--stdin=Microsoft-MIEngine-In-emhvpzpo.syb' '--stdout=Microsoft-MIEngine-Out-dht4nkur.p5d' '--stderr=Microsoft-MIEngine-Error-cpkcr2pw.mzq' '--pid=Microsoft-MIEngine-Pid-v2fsb4cd.no1' '--dbgExe=C:/MinGW/bin/gdb.exe' '--interpreter=mi' 
PS C:\Users\hakan\projects\onecpp> 
调试控制台

=thread-group-added,id="i1"
GNU gdb (GDB) 7.6.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param="pagination",value="off"
=cmd-param-changed,param="args",value="2>CON 1>CON <CON"
[New Thread 9284.0x16f4]
x number is 1525
z number 2 is 1013
The program 'C:\Users\hakan\projects\onecpp\asd.exe' has exited with code 0 (0x00000000).
=已添加线程组,id=“i1”
GNU gdb(gdb)7.6.1
版权所有(C)2013免费软件基金会。
许可证GPLv3+:GNU GPL版本3或更高版本
这是自由软件:您可以自由更改和重新发布它。
在法律允许的范围内,不存在任何担保。键入“显示复制”
和“显示保修”了解详细信息。
此GDB配置为“mingw32”。
有关错误报告说明,请参阅:
.
警告:未检测到调试对象目标体系结构,假定为x86_64。
=cmd param changed,param=“分页”,value=“关闭”

=cmd param changed,param=“args”,value=“2>CON 1>CON不推荐使用设置
“externalConsole”:false。请尝试使用
“console”:“integratedTerminal”“
使用最新版本的Visual Studio代码。对于我来说,集成终端中的控制台输入工作正常。

从调试控制台输出看,它工作正常?是的,但当我编写程序输入数据时,我无法输入数据,程序直接关闭。我认为如果你想使用标准输入,那么你需要使用一个外部控制台。这就是vscode需要做的。没有任何改变<不允许使用代码>属性控制台。
发出警告。@en0ndev的区别似乎在于您使用的是cppdbg。这和MinGW我有同样的问题。由于您的输出是asd.exe,我假设您使用的是Windows。尝试将“type”:“cppvsdbg”与“console”:“integratedTerminal”一起使用。这应该行得通。看起来会行得通,但我没有得到任何输出@en0ndev您正在查看“调试控制台”选项卡。这是错误的,您的应用程序控制台输入/输出转到“终端”。我必须承认这是非常误导的。终端的调试没有改变。
Windows PowerShell

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\hakan\projects\onecpp>  & 'c:\Users\hakan\.vscode\extensions\ms-vscode.cpptools-1.3.0-insiders4\debugAdapters\bin\WindowsDebugLauncher.exe' '--stdin=Microsoft-MIEngine-In-emhvpzpo.syb' '--stdout=Microsoft-MIEngine-Out-dht4nkur.p5d' '--stderr=Microsoft-MIEngine-Error-cpkcr2pw.mzq' '--pid=Microsoft-MIEngine-Pid-v2fsb4cd.no1' '--dbgExe=C:/MinGW/bin/gdb.exe' '--interpreter=mi' 
PS C:\Users\hakan\projects\onecpp> 
=thread-group-added,id="i1"
GNU gdb (GDB) 7.6.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param="pagination",value="off"
=cmd-param-changed,param="args",value="2>CON 1>CON <CON"
[New Thread 9284.0x16f4]
x number is 1525
z number 2 is 1013
The program 'C:\Users\hakan\projects\onecpp\asd.exe' has exited with code 0 (0x00000000).