Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use OutputDebugString from Windows 8 C++ / WinRT Component

I'm trying to write some debug info to the Visual Studio output window in a WinRT component. I ran across the function OutputDebugString which would appear to do what I want, however when I try to use it in my app I get "error 'OutputDebugString' identifier not found". I'm new to C++, am I missing a "using namespace" or include?

like image 478
James Cadd Avatar asked Feb 15 '23 10:02

James Cadd


1 Answers

You will need to add:

 #include <..\um\debugapi.h>

Sample call:

App::App()
{
    InitializeComponent();
    Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
    OutputDebugString(L"App initialized\n");
}
like image 137
Hans Passant Avatar answered Apr 02 '23 10:04

Hans Passant