Debugging VST in Visual Studio with Juce Plugin-Host

i am trying to figure out how to pass a string into the debug-output window in visual studio 2019 while i run the juce pluginhost process attachedin debug mode. std::cout doesnt seem to work. any ideas?

i found DBG() and it worked:

1 Like

nope. doesnt work… no idea why…

What doesn’t work? Some more information on what you are trying would help others here to help you and future readers of this thread :slight_smile:

DBG is the easiest way to print from a debug build on all platforms. It uses stdout on unix-based OS however on Windows there is no console to write to for a GUI application by default, so some tricks are used (I think by raising an exception) to let the text appear in the debug console. Statements wrapped in DBG are completely removed in release build.

For prints that should appear in both, debug and release builds there is Logger::writeToLog which appears in the same places in both release and debug builds, as long as you don’t set a custom logger.

If you want to use std::out or printf you have also the option to launch an extra console for your windows GUI application. I think this worked by something like this piece of code (untested)

#include <windows.h>

if (AllocConsole())
    freopen ("CONOUT$", "w", stdout);
    freopen ("CONOUT$", "w", stderr);
    ShowWindow (FindWindowA ("ConsoleWindowClass", NULL), false);

thanks a lot. sorry for my short comment. i am going to try your suggestions and will report back