This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center




已关闭8年。




我收到以下错误:

错误C2664:'CSchemaString::CSchemaString(LPCTSTR)':无法将参数1从'int'转换为'LPCTSTR'

对于以下代码:
for(i=0;i<=tComponent.GetUpperBound();i++)
{
    CSchemaString temp(i); // LINE AT WHICH ERROR OCCURS
    XComponent = ((Component *)tComponent.GetAt(i))->GetXMLCode(FOR_SAVING);               //AddName(*/temp +":"+*/ ((Component *)tComponent.GetAt(i))->GetName());
    XSave.AddPlant_Item(XComponent);

}

任何帮助。

最佳答案

您似乎正在尝试通过将temp(似乎是CSchemaString)作为参数来创建i作为int。如果我正确,则此类的可能构造函数为:

CSchemaString ()
CSchemaString (const tstring sValue)
CSchemaString (const TCHAR *szValue)
CSchemaString (const double nValue)
CSchemaString (const CSchemaType &rOther)

根据您的操作,也许您需要将i转换为字符串或 double 字,以符合CSchemaString构造函数签名?

09-25 18:28