I have been getting an "ToExpression::sntxi: Incomplete expression; more input is needed" error when trying to Install[] a new WSTP program I've written. It's entirely possible that there is some problem with the WSTP program, but this error doesn't give me a clue what it might be. I haven't even called the program yet, merely tried to Install[] it. Is there a WSTP or Install[] guru who might be able to suggest the circumstances under which running Install[] can produce such an odd error? For the record, a WSTP program does end up running, though unusable as it has returned only $Failed to the kernel.

Other WSTP programs install and run just fine.


The MathLink template file has Mathematica code in it. Almost certainly your template file has code with syntax errors. "Incomplete expression" indicates that you may have forgotten to close a bracket.

If you can't find the error, please post the template file.

| improve this answer | |
  • $\begingroup$ I will look into this when I get to the office, but your suggestion surprises me -- I compile my .tm file into C++ and include it in my build. Does Mathematica code survive that process? $\endgroup$ – Michael Stern Aug 31 '16 at 10:11
  • $\begingroup$ @MichaelStern Yes. You can check in the produced C file. It is partly this Mathematica code that sets up definitions when Install is run. It is also allowed to put arbitrary M code in the .tm file, which will be run on Install[]. $\endgroup$ – Szabolcs Aug 31 '16 at 10:42
  • $\begingroup$ I found several potential problems in the template, the proximate one almost certainly being a missing quotation mark. Thanks a million for this answer. $\endgroup$ – Michael Stern Aug 31 '16 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.