Error Function in External Function

Use this forum to post Vensim related questions.
Post Reply
yobiman
Member
Posts: 30
Joined: Wed May 28, 2008 1:28 am

Error Function in External Function

Post 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
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Post by Administrator »

What is the compile error?
yobiman
Member
Posts: 30
Joined: Wed May 28, 2008 1:28 am

Post 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
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Post 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.
yobiman
Member
Posts: 30
Joined: Wed May 28, 2008 1:28 am

Post 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
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Post 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
yobiman
Member
Posts: 30
Joined: Wed May 28, 2008 1:28 am

Post by yobiman »

Many thanks!
Phil
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Post 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
Post Reply