"...cannot be interpreted at compile time" I can't find the source of the error!

Pablo De Nápoli nospam at dev.null
Fri Aug 20 02:30:53 UTC 2021


I am trying to write a D wrapper for libmpdec 
(https://www.bytereef.org/mpdecimal/).

I get the following message (compiling with dmd with -v and 
-verrros=context)

     semantic2 cuenta
     mpdec/decimal.d(35,20): Error: `mpd_new` cannot be 
interpreted at compile time, because it has no available source 
code
           value=mpd_new(&decimal_ctx);// constructor from int

     caused by the following constructor...

class Decimal{

         mpd_t* value;


     this(int x)
         {
           value=mpd_new(&decimal_ctx);// constructor from int
           mpd_set_i32(value, x, &decimal_ctx);
         }

      }

The problem is that I cannot figure out which line in my code 
causes this constructor
to be interpreted at compile time! It would be useful if dmd 
could print more specific
error messages.

Any idea of which could be the cause of trouble or on how to get 
more specific 	diagnosis?
Many thanks!






More information about the Digitalmars-d-learn mailing list