调用函数的问题(两点坐标相同时)
<P>如何调用函数Equal_Points的问题:</P><P>在Attribute.h中:<BR>class CAttribute : public CDialog<BR>{<BR>// Construction<BR>public:<BR>int Equal_Points (const ads_point p1, const ads_point p2);/<BR> .............<BR> <BR>在Attribute.cpp中我的代码:<BR><FONT color=#1111ee>int</FONT> Equal_Points(const ads_point p1, const ads_point p2) //判断两点坐标p1,p2是否相等<BR>{<BR> // 指定误差范围<BR> const ads_real Equality_Margin = (ads_real)0.00000001; <BR> <BR> int c ;<BR> for (c = X ; c <= Z ; c++) {<BR> float ee=p1 - p2;<BR> if(fabs(ee) > Equality_Margin) { //(fabs(p1 - p2) > Equality_Margin) {<BR> return (<FONT color=#e61a94>0</FONT>) ;<BR> }<BR> }<BR> return (<FONT color=#ee1169>1</FONT>) ;<BR>}</P>
<P>我在Attribute.cpp下面的函数这样调用:<BR><FONT color=#3809f7>void</FONT> CAttribute::OnLine() //编 辑void CAttribute::OnLine() 函 数<BR>{ AcGePoint3d BPt;<BR>int k=0;<BR>ads_getpoint(NULL,"\n 第一点:",asDblArray(BPt)); <BR>for (i=1; <FONT color=#ee1169>k==1</FONT> ;i++) //当两点坐标相等时跳出循环<BR> { <BR> ads_getpoint(asDblArray(BPt),"\n 下一点:",asDblArray(BPt));<BR> <FONT color=#f70968> k= Equal_Points(asDblArray(BPt),asDblArray(BPt))</FONT>;//如果屏蔽该句则没问题<BR>//请问这样调用会出错,应该怎样改?<BR> }<BR>.........<BR>}<BR>可这样调用总是出错:<BR>Attribute.obj : error LNK2001: unresolved external symbol "public: int __thiscall </P>
<P>CAttribute::Equal_Points(double const * const,double const * const)" </P>
<P>(<A href="mailto:?Equal_Points@CAttribute@@QAEHQBN0@Z" target="_blank" >?Equal_Points@CAttribute@@QAEHQBN0@Z</A>)<BR>这里面还存在问题:const ads_point p1 ;好象不能使用<BR> AcGePoint3d BPt;定义的坐标?<BR></P> 你可能要解决负0问题,注意 -0!=0 。
页:
[1]