26140810 发表于 2023-8-11 07:11:40

重载函数时报错

//创建坐标标注
AcDbObjectId CDimensionUtil::AddDimOrdinate(Adesk::Boolean xAxis, AcGePoint3d &ptStart,const AcGePoint3d &ptEnd,const TCHAR *dimText,AcDbObjectId dimStyle)
{
        AcDbOrdinateDimension *pDim = new AcDbOrdinateDimension(xAxis,ptStart,ptEnd,dimText,dimStyle);
        return CDwgDatabaseUtil::PostToModelSpace(pDim);

}
//重载函数,创建坐标xy标注
AcDbObjectIdArray CDimensionUtil::AddDimOrdinate(const AcGePoint3d &ptDef,const AcGePoint3d &ptTextX,const AcGePoint3d &ptTextY)
{
        AcDbObjectId dimId;
        AcDbObjectIdArray dimIds;

        dimId = AddDimOrdinate(Adesk::kTrue,ptDef,ptTextX);   //编译时报错none of the 3 overloads could convert all the argument types
        dimIds.append(dimId);
        dimId = AddDimOrdinate(Adesk::kFalse,ptDef,ptTextY);//编译时报错none of the 3 overloads could convert all the argument types

        dimIds.append(dimId);

        return dimIds;

}

luowy 发表于 2023-8-18 16:47:37

CDimensionUtil::AddDimOrdinate 53

xmt 发表于 2023-8-21 09:48:40

可能是参数不对
dimId = AddDimOrdinate(Adesk::kTrue,ptDef,ptTextX,dimText,dimStyle);

革天明 发表于 2023-8-23 15:40:35

应该是刚学吧,上面提示的意思就是没有3个参数的重载,估计是抄代码时,没有注意到缺省参数
页: [1]
查看完整版本: 重载函数时报错