为什么在以下函数中出现此错误“ pngrutil.c:27:error:在'='标记之前的预期';',','或')'”?

皮尤什·库玛(Piyush Kumar)
double shrDelta(int iCounterID = 0){     //this is the 27  the line

    double DeltaT;            
    static struct timeval _NewTime;  
    static struct timeval _OldTime[3]; 
    gettimeofday(&_NewTime, NULL);  

    if (iCounterID >= 0 && iCounterID <= 2)
        {        

        DeltaT =  ((double)_NewTime.tv_sec + 1.0e-6 * (double)_NewTime.tv_usec) - ((double)_OldTime[iCounterID].tv_sec + 1.0e-6 * (double)_OldTime[iCounterID].tv_usec);        

        _OldTime[iCounterID].tv_sec  = _NewTime.tv_sec;     
        _OldTime[iCounterID].tv_usec = _NewTime.tv_usec;        
        }   
    else        
        {         

        DeltaT = -9999.0;       
        }     

    return DeltaT;
} 

该函数应该返回最后两次调用之间经过的时间。

拔示巴

C不支持函数参数的默认设置(或与此相关的函数重载)。

你需要写

double shrDelta(int iCounterID)

而是始终使用显式给出的参数值来调用该函数。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

Related 相关文章

热门标签

归档