Error C2065: "CoInitializeEx": undeclared identifier

When trying to use hres = CoInitializeEx(0, COINIT_MULTITHREADED);

I am getting the following error:

error C2065: "CoInitializeEx": undeclared identifier

I've already included:

#define _WIN32_DCOM
#include <iostream>
using namespace std;
#include <comdef.h>
#include <Wbemidl.h>

      

in my cpp file.

Please help.

Thanks, Nehu

+1


source to share


1 answer


Try placing the following line at the beginning of your precompiled header (stdafx.h).



#define _WIN32_WINNT 0x0400

      

+5


source







All Articles