Page 1 of 1

Error Function in External Function

Posted: Tue Aug 31, 2010 3:32 am
by yobiman
I am trying to write a simple external function in venext.c to calculate the error function. I have added #include math.h in the declarations and tryed to use the erf() function. When I do this I get a compile error.
Would appreciate any assistance with this

Thanks
Phil

Posted: Tue Aug 31, 2010 7:06 am
by Administrator
What is the compile error?

Posted: Tue Aug 31, 2010 4:20 pm
by yobiman
The error that I am getting is..

Error 7 error LNK2019: unresolved external symbol _erf referenced in function _ERF venext.obj venext6

Many thanks
Phil

Posted: Tue Aug 31, 2010 6:41 pm
by Administrator
You are missing the lib file that contains erf. Search google for the documentation for erf and see what library you need to include when linking.

Hope this helps.

Tony.

Posted: Tue Aug 31, 2010 7:09 pm
by yobiman
You're right I think that is the problem.. Looks like the easiest solution is to use a standard approximation

many thanks for your help

Phil

Posted: Wed Sep 01, 2010 9:39 am
by Administrator
If you can just add the .lib file to the linker options it should be fine.

You could also take a look at
http://social.msdn.microsoft.com/Forums ... c36e98d718

Posted: Wed Sep 01, 2010 4:55 pm
by yobiman
Many thanks!
Phil

Posted: Fri Sep 03, 2010 4:36 am
by tomfid
If you're using DSS, you can get a good approximation of ERF in a macro, without having to write an external function. See http://models.metasd.com/2010/05/cumula ... tribution/

Tom