问题描述
- No copy constructor available for class怎么解决呢
-
struct stuFileData { CString csIndex; CString csTime; CString csFunction; CString csLen; CString csData; CString csOneLine; //0为Normal //1000为随机cmd //1001为连接手机中断 int CmdFlag; stuFileData(CString csTmp) { if (csTmp.GetLength()>66) { //略 } else { //略 } } stuFileData() { //略 } stuFileData(const stuFileData &p) { csIndex = p.csIndex; csTime = p.csTime; csFunction = p.csFunction; csLen = p.csLen; csData = p.csData; csOneLine = p.csOneLine; CmdFlag = p.CmdFlag; } }; typedef CArray<stuFileData, stuFileData> DataPacketCArray;
DataPacketCArray b;
//初始化b,这里不写了DataPacketCArray a=b;
最后这个时,报
No copy constructor available for class 'CArray<struct stuFileData,struct stuFileData>'
怎么解决呢
解决方案
说的很清楚,定义一个拷贝构造函数
public: stuBushFileData(stuBushFileData & data)
{
... //在这里赋值
}
解决方案二:
no copy constructor available引发了一系列疑问
解决方案三:
无拷贝构造函数,楼上已说
解决方案四:
你的 Carray 在哪里定义的???
template
class CArray
{
//略
};
typedef CArray DataPacketCArray;
解决方案五:
不是拷贝构造的问题,你有写
时间: 2024-12-09 23:39:20