简体   繁体   English

如何在Visual Studio 2015中显示标准输出?

[英]How to display standard output in Visual Studio 2015?

Most IDE's I've seen (NetBeans, QtCreator, XCode, CodeBlocks, Eclipse) provide an out-of-the-box method to view standard output either in one of its embedded window or external console or in a log BUT Visual Studio. 我见过的大多数IDE(NetBeans,QtCreator,XCode,CodeBlocks,Eclipse)提供了一种开箱即用的方法,可以在其嵌入式窗口或外部控制台之一或日志中查看标准输出但是Visual Studio。

I really don't want to allocate a separate console as it is suggested at THIS question. 我真的不想按照 这个问题的建议分配一个单独的控制台 I'd also prefer not to redirect it to a file as it is suggested at THIS question (output file is not created with the suggested console command ( 2>output.txt )). 我也不想将它重定向到文件,因为这个问题是建议的(输出文件不是用建议的控制台命令创建的( 2>output.txt ))。 Please don't give answers that modify the codebase like using OutputDebugString . 请不要像使用OutputDebugString那样给出修改代码库的答案

If displaying standard output inside VS this way is not possible, a working solution of the other two alternatives would still be welcomed, namely using external console (which I tried using without seeing the output in it) or a log file. 如果以这种方式在VS内部显示标准输出是不可能的,那么其他两个备选方案的工作解决方案仍然会受到欢迎,即使用外部控制台(我尝试使用它而不看其中的输出)或日志文件。

If it is only for debugging purposes, you might find Debug Breakpoints/Tracepoint actions helpful. 如果它仅用于调试目的,您可能会发现Debug Breakpoints / Tracepoint操作很有帮助。 They enable to log custom strings with expressions (ie variables) to the visual studio console. 它们可以将带有表达式(即变量)的自定义字符串记录到visual studio控制台。

For a non-console windows application, by default (ie without changing your codebase, as you are requesting) all output to stdout is lost.. 对于非控制台窗口应用程序,默认情况下(即,无需更改代码库,因为您要求)所有输出到stdout都会丢失。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM