Confusing CoInitialize issue


#1

I have a audio playback class what works fine in a JUCE project that uses a GUI. I have just tried using the same class in a console application and I hit the following assertion:

 

jassert (hr != CO_E_NOTINITIALIZED); // You haven't called CoInitialize for the current thread!

 

in juce_win32_ComSmartPtr.h, when I try to initialize my AudioDeviceManager.

 

I did some googling and tried adding 'CoInitialize(0)' at the top of my class but CoInitialize is undefined.

 

Can someone tell me what I am missing?

Thanks!


#2

Well, if you read the comment, it says you haven't called it for the current thread

Maybe wherever you added your call was being run from a different thread to the one that needs it?