这两天学习了一下DSOFrame,但是用VS2010一直编译不过,通过一天的调试,最后还是搞定了,以下是一些总结,共享一下,希望对你有所帮助。
下载资源:http://download.csdn.net/detail/autopine1/9206147
1. dsoframedemo\ms_dsoframer\XMLHttpClient.h(42):error C4430: missing type specifier - int assumed. Note: C++ does not supportdefault-int
解决方法:
打开:项目----项目属性----配置属性----C/C++----命令行,在附加选项那里添加/wd4430这个选项。
2. 把msoffice.h 中的using namespace放到#import之后
3. 在dsoframer.h中加入头文件#include <Mshtmlc.h>注意顺序,要放到msoffice.h之前
4. 错误:(64位的Win7)
1>C:\Program Files (x86)\Microsoft VisualStudio 10.0\VC\atlmfc\include\atlbase.h(2867): error C2065: 'CLSID_StdGlobalInterfaceTable': undeclared identifier
1>C:\Program Files (x86)\Microsoft VisualStudio 10.0\VC\atlmfc\include\atlbase.h(3060): error C2065:'CLSID_StdGlobalInterfaceTable' : undeclared identifier
解决方法:
atlbase.h Line33 加上头文件
#include <CGuid.h>
5. (32位的Win7)
C:\Program Files \MicrosoftSDKs\Windows\v7.0A\Include\atlcomcli.h-àLine88
添加:
extern const IID GUID_NULL;
6. 把msword9.cpp中的引用位置转换一下
#include "msword9.h"
#include "utilities.h"
7. 把msword9.h中的CWindow0(const Window& dispatchSrc) : COleDispatchDriver(dispatchSrc){}
改成
CWindow0(const CWindow0& dispatchSrc): COleDispatchDriver(dispatchSrc){}
8. 错误:LINK : fatal error LNK1104: cannot open file 'libc.lib'
解决办法,在Project-->Setting-->Linker-->Command Line-->Additionaloptions中加入:
/Nodefaultlib:libc
/Nodefaultlib:libcp
9. 别忘了把名称修改一致:
10. Configuration PropertiesàGeneralàTarget Extensionà.ocx
以上完成后,就可以用VS2010把这个ocx编译通过了