从别人的程序拷过来的部分代码,
编译老是error C2065: 'CoCreateInstanceEx ' : undeclared identifier,
在别人的程序查找 'CoCreateInstanceEx '的定义,是在VC98\Include\OBJBASE.H文件里面声明的,
然后我在自己的程序里面加上#include <OBJBASE.H> 还是没用,一样的错误.
又在别人的程序里面找 "OBJBASE.H "字符串,没找到,奇怪了,咋办哦,帮帮我,我好菜啊
Try
#define _WIN32_WINNT 0x0400
in your stdafx.h
不行啊
还有:他的是win32 unicode的,我的是win32,不知道这个有没有影响,怎么建立win32 unicode的工程啊
#define _WIN32_DCOM
#define _WIN32_WINNT 0x0500
or
From the 'Project | Settings ' menu, go to 'C++ ' tab. Choose the
'Preprocessor ' category. Add a define _WIN32_DCOM in the preprocessor definition 's edit box. Note that defines are separated by commas
谢谢!,我是把他的Preprocessor项目下的Edit里面的东西拷到我的里面,就好了
他的是:
/nologo /MD /W3 /GX /O2 /D "WIN32 " /D "NDEBUG " /D "_WINDOWS " /D "_AFXDLL " /D "_WIN32_DCOM " /D "_CLIENT " /D "_UNICODE " /Fp "releaseu/opctestclient.pch " /YX "stdafx.h " /Fo "releaseu/ " /Fd "releaseu/ " /FD /c
我的是:
/nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32 " /D "_DEBUG " /D "_WINDOWS " /D "_AFXDLL " /D "_MBCS " /FR "Debug/ " /Fp "Debug/OPCServer.pch " /Yu "stdafx.h " /Fo "Debug/ " /Fd "Debug/ " /FD /GZ /c
实在看不懂,能解释一下吗,谢谢!!!!!!!!!!!!!!!!!!!!!!!!!!!!
可是release下还是出现这种情况
add
/D "_WIN32_DCOM "
to the settings for the release version
http://topic.csdn.net/t/20020822/01/960098.html