# Debugging VST in Visual Studio with Juce Plugin-Host

**URL:** <https://forum.juce.com/t/debugging-vst-in-visual-studio-with-juce-plugin-host/37300>\
**Category:** Windows\
**Created:** [January 24, 2020, 1:01am UTC](https://forum.juce.com/t/debugging-vst-in-visual-studio-with-juce-plugin-host/37300 "2020-01-24T01:01:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![greitzlechner](https://avatars.discourse-cdn.com/v4/letter/g/4af34b/32.png) [@greitzlechner](https://forum.juce.com/u/greitzlechner)\
**Post date:** [January 24, 2020, 1:01am UTC](https://forum.juce.com/t/debugging-vst-in-visual-studio-with-juce-plugin-host/37300/1 "2020-01-24T01:01:37Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![greitzlechner](https://avatars.discourse-cdn.com/v4/letter/g/4af34b/32.png) [@greitzlechner](https://forum.juce.com/u/greitzlechner)\
**Post date:** [January 24, 2020, 1:13am UTC](https://forum.juce.com/t/debugging-vst-in-visual-studio-with-juce-plugin-host/37300/2 "2020-01-24T01:13:05Z")

</div>

i found DBG() and it worked:  
[https://docs.juce.com/master/group\_\_juce\_\_core-system.html#ga679635952a5d2eb25f3b31398f0fcc25](https://docs.juce.com/master/group __juce__ core-system.html#ga679635952a5d2eb25f3b31398f0fcc25)

---

<div class="post-metadata">

**Author:** ![greitzlechner](https://avatars.discourse-cdn.com/v4/letter/g/4af34b/32.png) [@greitzlechner](https://forum.juce.com/u/greitzlechner)\
**Post date:** [January 26, 2020, 3:29pm UTC](https://forum.juce.com/t/debugging-vst-in-visual-studio-with-juce-plugin-host/37300/3 "2020-01-26T15:29:14Z")

</div>

nope. doesnt work… no idea why…

---

<div class="post-metadata">

**Author:** ![PluginPenguin](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/pluginpenguin/32/10203_2.png) [@PluginPenguin](https://forum.juce.com/u/PluginPenguin)\
**Post date:** [January 26, 2020, 4:00pm UTC](https://forum.juce.com/t/debugging-vst-in-visual-studio-with-juce-plugin-host/37300/4 "2020-01-26T16:00:24Z")

</div>

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 🙂

`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)

```auto
#include <windows.h>

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

```

---

<div class="post-metadata">

**Author:** ![greitzlechner](https://avatars.discourse-cdn.com/v4/letter/g/4af34b/32.png) [@greitzlechner](https://forum.juce.com/u/greitzlechner)\
**Post date:** [January 26, 2020, 4:04pm UTC](https://forum.juce.com/t/debugging-vst-in-visual-studio-with-juce-plugin-host/37300/5 "2020-01-26T16:04:14Z")

</div>

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