编译结果:-------------------Configuration: Serial - Win32 Release--------------------Compiling...functions.cppD:\GAMBIT\2D0722\Serial\profile.h(49) : error C2377: &#39OINT&#39; : redefinition; typedef cannot be overloaded with any other symbol C:\Program Files\Microsoft Visual Studio\VC98\Include\windef.h(310) : see declaration of &#39OINT&#39;D:\GAMBIT\2D0722\Serial\slide.h(141) : warning C4005: &#39;ASSERT&#39; : macro redefinition C:\Program Files\Microsoft Visual Studio\VC98\MFC\Include\afx.h(245) : see previous definition of &#39;ASSERT&#39;D:\GAMBIT\2D0722\Serial\functions.cpp(22) : warning C4305: &#39;=&#39; : truncation from &#39;const double&#39; to &#39;float&#39;D:\GAMBIT\2D0722\Serial\functions.cpp(23) : warning C4305: &#39;=&#39; : truncation from &#39;const double&#39; to &#39;float&#39;D:\GAMBIT\2D0722\Serial\functions.cpp(25) : warning C4305: &#39;=&#39; : truncation from &#39;const double&#39; to &#39;float&#39;D:\GAMBIT\2D0722\Serial\functions.cpp(26) : warning C4305: &#39;=&#39; : truncation from &#39;const double&#39; to &#39;float&#39;执行 cl.exe 时出错.functions.obj - 1 error(s), 0 warning(s)#include "udf.h" DEFINE_GEOM(UDF,d,dt,position) { real T,f; real pi; real R0,R1,R2; real a,b; real c1,c2,c3; real e1,e2; real s; T=CURRENT_TIME; f=200000; pi=3.141592653; R0=0.15; a=0.01; b=0.01; R1=(2.830030237-a+841/(2.830030237-a))/2000; R2=(b+2.830030237+841/(b+2.830030237))/2000; s=-sin(2*pi*f*T); if(s>0) { c1=sqrt(R2*R2-position[0]*position[0]); c2=sqrt(R0*R0-position[0]*position[0]); c3=sqrt(R2*R2-R0*R0*0.1933333333*0.1933333333); position[1]=c2+s*(c1-c2+R0*0.981133131756-c3); } else if(s<0) { e1=sqrt(R1*R1-position[0]*position[0]); c2=sqrt(R0*R0-position[0]*position[0]); e2=sqrt(R1*R1-R0*R0*0.1933333333*0.1933333333); position[1]=c2+s*(c2-e1+e2-R0*0.981133131756); } } }[img][/img]上面源程序如果不清晰,请看下面:#include &quot;udf.h&quot;DEFINE_GEOM(UDF,d,dt,position){ real T,f; real pi; real R0,R1,R2; real a,b; real c1,c2,c3; real e1,e2; real s; T=CURRENT_TIME; f=200000; pi=3.141592653; R0=0.15; a=0.01; b=0.01; R1=(2.830030237-a+841/(2.830030237-a))/2000; R2=(b+2.830030237+841/(b+2.830030237))/2000; s=-sin(2*pi*f*T); if(s>0) { c1=sqrt(R2*R2-position[0]*position[0]); c2=sqrt(R0*R0-position[0]*position[0]); c3=sqrt(R2*R2-R0*R0*0.1933333333*0.1933333333); position[1]=c2+s*(c1-c2+R0*0.981133131756-c3); } else if(s<0) { e1=sqrt(R1*R1-position[0]*position[0]); c2=sqrt(R0*R0-position[0]*position[0]); e2=sqrt(R1*R1-R0*R0*0.1933333333*0.1933333333); position[1]=c2+s*(c2-e1+e2-R0*0.981133131756); }}} |
|
|
|
|
共 3 个关于本帖的回复 最后回复于 2013-8-9 08:51