How do I output debug info to visual studio for a fusion 360 c++ addin?

How do I output debug info to visual studio for a fusion 360 c++ addin?

chetmurphy
Contributor Contributor
588 Views
1 Reply
Message 1 of 2

How do I output debug info to visual studio for a fusion 360 c++ addin?

chetmurphy
Contributor
Contributor

The title says it all. I've tried stdio, streams, and windows output debug string (perhaps not the right set of headers),  but all generate link errors or silently fail. Are there any sample programs?

 

I'm using Windows 10 with the 2019 Community version of Visual Studio.

0 Likes
589 Views
1 Reply
Reply (1)
Message 2 of 2

chetmurphy
Contributor
Contributor

The problem is that you need window.h header. As a quick solution I found that the windows.h header was included the main generated cpp for an addin, so I added a simple wrapper around OutputDebugStringA just below the windows.h and debugapi.h headers and then call that function in the rest of my files. It now works on Windows and the wrapper can be replace on the Mac.

 

#include <windows.h>
#include <debugapi.h>

void XOutputDebugString(const char* str)
{
        OutputDebugStringA(str);
}

0 Likes