+ -
当前位置:首页 → 问答吧 → 兄弟们帮我看下这代码要怎么修改?

兄弟们帮我看下这代码要怎么修改?

时间:2011-12-24

来源:互联网

__declspec(dllexport) int WINAPI LQ(CALCINFO* pData)
{
if ( pData->m_pfParam1 && //参数1有效
pData->m_nParam1Start<0 && //参数1为常数
pData->m_pfParam2==NULL ) //仅有一个参数
{
float fParam = *pData->m_pfParam1;
int nPeriod = (int)fParam; //参数1
if(nPeriod>0)
{
float fTotal,WDm601;
int i, j;
  pData->m_pResultBuf[0]=pData->m_pData[0].m_fClose;
  WDm601=pData->m_pResultBuf[0];
for ( i = nPeriod-1; i < pData->m_nNumData; i++ )//计算nPeriod周期的均线,数据从nPeriod-1开始有效
{
fTotal = 0.0f;
   
  if ( i % nPeriod = 0 )
  { pData->m_pResultBuf[i] = (pData->m_pData[i])*2/(nPeriod+1)+(nPeriod-1)*pData->m_pResultBuf[i-1]/(nPeriod+1);
WDm601=pData->m_pResultBuf[i]; }
  else
  pData->m_pResultBuf[i] = (pData->m_pData[i])*2/(nPeriod+1)+(nPeriod-1)*WDm601/(nPeriod+1);
}
return nPeriod-1;
}
}
return -1;
}

出错提示:
--------------------Configuration: FOXFUNC - Win32 Debug--------------------
Compiling...
FoxFunc.cpp
E:\SoftWare\FOXFUNC\FoxFunc.cpp(44) : error C2106: '=' : left operand must be l-value
E:\SoftWare\FOXFUNC\FoxFunc.cpp(45) : error C2676: binary '*' : 'const struct tagSTKDATA' does not define this operator or a conversion to a type acceptable to the predefined operator
E:\SoftWare\FOXFUNC\FoxFunc.cpp(48) : error C2676: binary '*' : 'const struct tagSTKDATA' does not define this operator or a conversion to a type acceptable to the predefined operator
执行 cl.exe 时出错.

FoxFunc.obj - 1 error(s), 0 warning(s)

作者: oceanwindcd   发布时间: 2011-12-24

float fParam = *pData->m_pfParam1;
改成
float fParam = pData->m_pfParam1;根据你的命名m_pfParam1好像是个指针,如果是指针
float fParam = *(pData->m_pfParam1);

作者: dahaiI0   发布时间: 2011-12-24