总结了编译Com技术内幕的最后例子的编译问题. 收藏
2013-07-24 10:29
423 查看
总结了编译Com技术内幕的最后例子的编译问题. 收藏
在编译<Com技术内幕>>的最后一个例子程序时碰到的问题:
编译:Canvas
1: midl : command line error MIDL1001 : cannot open input file canvas_i.idl
通过菜单: Tool->Options->Directories 把TANGRAM目录中的IDL文件夹加入到:Include files.
2: fatal error C1083: Cannot open include file: 'CUnknown.h': No such file or directory
通过菜单: Tool->Options->Directories 把TANGRAM目录中的Common文件夹加入到:Include files.
3: fatal error C1083: Cannot open include file: 'Canvas_I.h': No such file or directory
通过菜单: Tool->Options->Directories 把TANGRAM目录中的Share文件夹加入到:Include files.
4: fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
在Canvas.cpp文件的最前面,也就是#include <windows>前加上 #include <afx.h>
在看到这个错误的时候,可以看到在这行的前面是编译哪个文件出现的问题,在这里看到的是Canvas.cpp,
如果在编译别的程序的时候,也出现这样的问题,按照同样的方法处理.
5: error C2065: 'IsValidAddress' : undeclared identifier
把在Canvas.cpp中 #include "util.h"改为
#include <atlbase.h>
#include "..\\common\\util.h"
6: error C2440: '=' : cannot convert from 'void *' to 'struct HINSTANCE__ *'
把CFactory::s_hModule = hModule ;改为:
CFactory::s_hModule = (HINSTANCE)hModule ;
编译成功
2. 编译:GdiWrld
按照上面操作后,还出现如下错误:
1). fatal error C1083: Cannot open include file: 'tantype.h': No such file or directory
2). 'E:\OPC\TANGRAM\share\Event_I.c': No such file or directory
看了一下Event_I.c这个文件是由IDL目录下的Event.IDL通过midl产生的,而Event.IDL在编译Model时才编译,因此我们先
编译Model
3. 编译Model
出现的新的错误为:
1. error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class
std::list<struct tagCONNECTDATA,class std::allocator<struct tagCONNECTDATA> >::const_iterator' (or there is
no acceptable conversion)
通过双击该错误,定位错误,然后把前面一行CConnectionPointList::iterator p ; 改为:
CConnectDataList::const_iterator p;
也就是把iterator改为const_iterator
编译通过
继续编译GdiWrld.
出现的错误为:
error C2440: 'initializing' : cannot convert from 'void *' to 'struct HPEN__ *'
error C2440: 'initializing' : cannot convert from 'void *' to 'struct HBRUSH__ *'
进行强制转换一下
编译通过.
4. 编译GlWrld
出现的新问题是:
error C2065: 'assert' : undeclared identifier
加入头文件:
#include <assert.h>
出现的其他错误记得把"util.h"改为:"..\\common\\util.h"即可。
5. 编译Tangram
没出现什么新问题,顺利成功。
6. 运行的时候可能会提示没有注册类别
把编译生成的dll注册一下,同时把Tangram注册为服务:
Tangram.exe regserver
在编译<Com技术内幕>>的最后一个例子程序时碰到的问题:
编译:Canvas
1: midl : command line error MIDL1001 : cannot open input file canvas_i.idl
通过菜单: Tool->Options->Directories 把TANGRAM目录中的IDL文件夹加入到:Include files.
2: fatal error C1083: Cannot open include file: 'CUnknown.h': No such file or directory
通过菜单: Tool->Options->Directories 把TANGRAM目录中的Common文件夹加入到:Include files.
3: fatal error C1083: Cannot open include file: 'Canvas_I.h': No such file or directory
通过菜单: Tool->Options->Directories 把TANGRAM目录中的Share文件夹加入到:Include files.
4: fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
在Canvas.cpp文件的最前面,也就是#include <windows>前加上 #include <afx.h>
在看到这个错误的时候,可以看到在这行的前面是编译哪个文件出现的问题,在这里看到的是Canvas.cpp,
如果在编译别的程序的时候,也出现这样的问题,按照同样的方法处理.
5: error C2065: 'IsValidAddress' : undeclared identifier
把在Canvas.cpp中 #include "util.h"改为
#include <atlbase.h>
#include "..\\common\\util.h"
6: error C2440: '=' : cannot convert from 'void *' to 'struct HINSTANCE__ *'
把CFactory::s_hModule = hModule ;改为:
CFactory::s_hModule = (HINSTANCE)hModule ;
编译成功
2. 编译:GdiWrld
按照上面操作后,还出现如下错误:
1). fatal error C1083: Cannot open include file: 'tantype.h': No such file or directory
2). 'E:\OPC\TANGRAM\share\Event_I.c': No such file or directory
看了一下Event_I.c这个文件是由IDL目录下的Event.IDL通过midl产生的,而Event.IDL在编译Model时才编译,因此我们先
编译Model
3. 编译Model
出现的新的错误为:
1. error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class
std::list<struct tagCONNECTDATA,class std::allocator<struct tagCONNECTDATA> >::const_iterator' (or there is
no acceptable conversion)
通过双击该错误,定位错误,然后把前面一行CConnectionPointList::iterator p ; 改为:
CConnectDataList::const_iterator p;
也就是把iterator改为const_iterator
编译通过
继续编译GdiWrld.
出现的错误为:
error C2440: 'initializing' : cannot convert from 'void *' to 'struct HPEN__ *'
error C2440: 'initializing' : cannot convert from 'void *' to 'struct HBRUSH__ *'
进行强制转换一下
编译通过.
4. 编译GlWrld
出现的新问题是:
error C2065: 'assert' : undeclared identifier
加入头文件:
#include <assert.h>
出现的其他错误记得把"util.h"改为:"..\\common\\util.h"即可。
5. 编译Tangram
没出现什么新问题,顺利成功。
6. 运行的时候可能会提示没有注册类别
把编译生成的dll注册一下,同时把Tangram注册为服务:
Tangram.exe regserver
相关文章推荐
- 总结了编译Com技术内幕的最后例子的编译问题.
- 总结了编译Com技术内幕的最后例子的编译问题.
- com 技术内幕的例子
- Tomcat 7 编译JSP2.0技术手册中的例子出现的错误问题
- .obj : error LNK2001: unresolved external symbol _IID_IX 头文件的顺序问题(以COM技术内幕第七章为例)
- GCOGE技术内幕-Gcoge酷鸽传媒官方网站 Gcoge.com-酷哥一下,问题搞定!
- GCOGE技术内幕-Gcoge酷鸽传媒官方网站 Gcoge.com-酷哥一下,问题搞定!
- GCOGE技术内幕-Gcoge酷鸽传媒官方网站 Gcoge.com-酷哥一下,问题搞定!
- GCOGE技术内幕-Gcoge酷鸽传媒官方网站 Gcoge.com-酷哥一下,问题搞定!
- GCOGE技术内幕-Gcoge酷鸽传媒官方网站 Gcoge.com-酷哥一下,问题搞定!
- 关于一个VC++6.0技术内幕的COM错误问题,错误信息:error C2504: 'IMotion' : base class undefined
- Linux 编译报错 -- undefined reference to 问题解决方法 (具体'pthread_create'和opencv看文章最后两条)
- 如何解决编译iPhone例子报错的问题
- DICOM:dcm4chee开源框架编译相关问题总结
- 35岁时搞技术还搞的动吗?(总结+原创)+软件靠吃年轻饭、学习技巧、就业或上研等问题之我见
- iOS: FFmpeg编译和使用问题总结
- com技术内幕--读书笔记(3)
- Linux c编译,运行遇到的问题总结
- iOS开发之隐藏tabbar--解决隐藏后依然不能响应对应位置事件的问题 分类: ios技术 2015-04-21 11:24 261人阅读 评论(0) 收藏
- Ubuntu 问题与技巧 总结收藏