Hey I am running into a problem with CoCreateInstance() in a program that I am using to try to disable all the network adapters.

When I try to use

hr = CoCreateInstance(CLSID_ConnectionManager,
		NULL,
		CLSCTX_LOCAL_SERVER | CLSCTX_NO_CODE_DOWNLOAD,
		IID_INetConnectionManager,
		reinterpret_cast<LPVOID *>(&pNetConnectionManager)
		);

I get two errors.

undefined reference to `_IID_INetConnectionManager'
undefined reference to `_CLSID_ConnectionManager'

I am using Code::Blocks and Windows XP.

Also I have the following headers/libs
windows.h
objbase.h
Netcon.h
libole32.a

The error messages indicate you are not linking with one or more required libraries. I don't know which one(s) though.

Have you seen this thread?

Yes with NULL passed in it.

CoInitialize(NULL);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.