How do I write to the Visual Studio Output Window in My Custom Tool?

前端 未结 5 1698
我寻月下人不归
我寻月下人不归 2020-12-07 16:08

I am writing a custom tool and I currently have it doing what I want as far as functionality. I would like to be able to write to Visual Studio if something goes wrong. (In

5条回答
  •  半阙折子戏
    2020-12-07 16:37

    If you want anything to appear in the Output window, it has to come from stdout. To do this, your app needs to be linked as a "console" app. Set the /SUBSYSTEM:CONSOLE flag in the project's property page, under Linker/System set the SubSystem property to CONSOLE.

    Once you have your output in the window, if you include the text "Error:" it will appear as an error, or if you set "Warning:" it will appear as a warning. If your error text begins with a path/filename, followed by a line number in parenthesis, the IDE will recognize it as a "clickable" error, and navigate you automatically to the faulting line.

提交回复
热议问题