首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

CArray <CPoint,CPoint> myArray1失误

2013-01-02 
CArray CPoint,CPoint myArray1出错#include stdafx.h#include afxtempl.hint main(int argc, char*

CArray <CPoint,CPoint> myArray1出错

#include "stdafx.h"
#include <afxtempl.h>

int main(int argc, char* argv[])
{
CArray <CPoint,CPoint> myArray1;
myArray1.SetSize(10,128);
CArray <CPoint,CPoint> myArray2;
myArray2.SetSize(10,128);
myArray2.Add(CPoint(11,22));
myArray2.Add(CPoint(12,42));

myArray1.Add(CPoint(1,2));
myArray1.Append(myArray2);
return 0;
}
这段代码出错了,error C2065: 'CPoint' : undeclared identifier
error C2955: 'CArray' : use of class template requires template argument list
[解决办法]
应该是头文件没有包含的缘故吧。CPoint定义在<afxwin.h>,包含这个文件看看。
[解决办法]
哦,应该是“use run-time library”选择“debug multithreaded” 
[解决办法]
console程序中利用MFC的类,使用MFC的库

热点排行