Debug Output

 

Hi folks, new here - glad to find the forum!

I have a basic question regarding debug output. I was reading the FAQ and it states that I can use the Console::WriteLine and ::Write methods to get output into the Output pane when I launch my application in debug mode. Now, (in MS Visual C++ .NET 2003), the Debug menu lists F5 to "Start" and CTRL+F5 to "Start without Debugging", so I assumed that by pressing F5 I'm launching my app in debug mode. However, when I do this, I'm not seeing a window of any kind outputting my test commands.

In the Output pane, I see a good number of statements regarding dll's being loaded and that's about it.

Basically, the app is a Windows Forms program with a button control. For the buttons click event I've got the following code:

 private: System::Void button1_Click(System::Object *  sender, System::EventArgs *  e)
    {
     MessageBox::Show("Test");
     System::Console::WriteLine(S"This is a test.");
    }

When I click the button, I see the Message Box, but after clicking it's OK button, I get nothing in the Output | Debug pane.

Additionally, I've also tried setting a break point on the call to WriteLine(). When the instruction pointer gets there, I step into the code, but still get no message in the Output pane.

I just can't figure out what I'm doing wrong here. Any suggestions

Thanks,

    Zero



Answer this question

Debug Output

  • BobbyVee

    In order for the output of your application to appear in the Output window, you need to use the System::Diagnostics::Debug object (you can also use the System::Diagnostics::Trace object).

        1 void F(void)
        2 {
        3     System::Diagnostics::Debug::WriteLine(S"Hello World!");
        4 }

    Habib Heydarian
    Program Manager
    Visual Studio Debugger


  • Andrei Gradinari

    Awesome, Habib! It worked! Thankyou!
  • Debug Output