谁用过CArray<type,arg_type>
我用vc6.0 声明CArray <CPoint,CPoint> aa;
系统报错:
test7_29.cpp
d:\c++_pro\test7_29\testdoc.h(51) : error C2143: syntax error : missing ';' before '<'
d:\c++_pro\test7_29\testdoc.h(51) : error C2501: 'CArray' : missing storage-class or type specifiers
d:\c++_pro\test7_29\testdoc.h(51) : error C2059: syntax error : '<'
d:\c++_pro\test7_29\testdoc.h(51) : error C2238: unexpected token(s) preceding ';'
testDoc.cpp
d:\c++_pro\test7_29\testdoc.h(51) : error C2143: syntax error : missing ';' before '<'
d:\c++_pro\test7_29\testdoc.h(51) : error C2501: 'CArray' : missing storage-class or type specifiers
d:\c++_pro\test7_29\testdoc.h(51) : error C2059: syntax error : '<'
d:\c++_pro\test7_29\testdoc.h(51) : error C2238: unexpected token(s) preceding ';'
testView.cpp
d:\c++_pro\test7_29\testdoc.h(51) : error C2143: syntax error : missing ';' before '<'
d:\c++_pro\test7_29\testdoc.h(51) : error C2501: 'CArray' : missing storage-class or type specifiers
d:\c++_pro\test7_29\testdoc.h(51) : error C2059: syntax error : '<'
d:\c++_pro\test7_29\testdoc.h(51) : error C2238: unexpected token(s) preceding ';'
大侠帮忙
问题点数:50、回复次数:5Top
1 楼steedhorse(晨星)回复于 2003-08-03 22:00:43 得分 10
#include <afxtempl.h>Top
2 楼steedhorse(晨星)回复于 2003-08-03 22:02:27 得分 10
通常这些常用的头文件在StdAfx.h中添加比较好,VC自动生成的各个cpp文件都会包含StdAfx.h,所以后面就不用每一次都添加了。Top
3 楼zswzwy(酒是穿肠毒药 @ 色是刮骨钢刀)回复于 2003-08-03 22:07:04 得分 10
#include <afxtempl.h>
Top
4 楼nonocast(如果没有如果)回复于 2003-08-03 22:07:53 得分 10
呵呵,加入头文件即可。
#include <afxtempl.h>
如果下次遇到相同的问题可以查一下MSDN,上面有写的
顺便提醒你一下,CArray <CPoint,CPoint> aa;
第一个CPoint是aa中放的类型,而后面一个是函数的参数类型。小心使用。
CArray <CPoint,&CPoint> bb;不要和你写的搞在一起。
-------------------------
May you succeed!
------------------------
Top
5 楼steedhorse(晨星)回复于 2003-08-03 22:24:56 得分 10
对,不过应该是:
CArray <CPoint,CPoint&> bb;
吧?
这样可以提高效率。Top



