CoInitializeEx

L

Larry Brasfield

Paul said:
Hi, Hi.

I am trying to use CoInitializeEx but VC++ 6.0 compiler always complaining
error C2065: 'CoInitializeEx' : undeclared identifier.

According to MSDN
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/htm/cmf_a2c_5iyg.asp),
CoInitializeEx is in "ole32.lib" and I have it in my "Project -> Settings ->
Link -> Object/library modules".

Is there anywhere else I forgot to include?

Somewhere before that ill-fated usage, write
#define _WIN32_WINNT 0x0400
#include <ole2.h>

You might want to study the following screen-scrape and
think about the implication a little bit.
=====================================
[C:\tmp]
pushd \Programs\DevStud.NET.2003\Vc7\PlatformSDK\Include\
[C:\Programs\DevStud.NET.2003\Vc7\PlatformSDK\Include]
findstr CoInitializeEx *.h
....
ObjBase.h:WINOLEAPI CoInitializeEx(IN LPVOID pvReserved, IN DWORD dwCoInit);

[C:\Programs\DevStud.NET.2003\Vc7\PlatformSDK\Include]
findstr /i objbase.h *.h | findstr include
....
======================================
(edited for length)
Please advice, thanks!

Your error message came from the compiler.
Your settings shown above affect the linker.
Those tools are distinctly different and you should
learn to distinguish them to help sort out problems
of this nature on your own.
 
G

Guest

Got it, thx!

Larry Brasfield said:
Paul said:
Hi, Hi.

I am trying to use CoInitializeEx but VC++ 6.0 compiler always complaining
error C2065: 'CoInitializeEx' : undeclared identifier.

According to MSDN
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/htm/cmf_a2c_5iyg.asp),
CoInitializeEx is in "ole32.lib" and I have it in my "Project -> Settings ->
Link -> Object/library modules".

Is there anywhere else I forgot to include?

Somewhere before that ill-fated usage, write
#define _WIN32_WINNT 0x0400
#include <ole2.h>

You might want to study the following screen-scrape and
think about the implication a little bit.
=====================================
[C:\tmp]
pushd \Programs\DevStud.NET.2003\Vc7\PlatformSDK\Include\
[C:\Programs\DevStud.NET.2003\Vc7\PlatformSDK\Include]
findstr CoInitializeEx *.h
....
ObjBase.h:WINOLEAPI CoInitializeEx(IN LPVOID pvReserved, IN DWORD dwCoInit);

[C:\Programs\DevStud.NET.2003\Vc7\PlatformSDK\Include]
findstr /i objbase.h *.h | findstr include
....
======================================
(edited for length)
Please advice, thanks!

Your error message came from the compiler.
Your settings shown above affect the linker.
Those tools are distinctly different and you should
learn to distinguish them to help sort out problems
of this nature on your own.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top