3
$\begingroup$

I have a need for integrating/running C++ code in Mathematica. To this extend I've been using MathLink, and now since sth like 10 years WSTP. I have created tooling for using C++ the C code in the context of C++ concepts. This all works fine, and I am very happy with the abilities of WSTP.

There is a bit of an issue though, and that is with outputting debugging output for the code. When I was using MathLink, installing an executable would spawn a terminal onto which I can stream text using std::cout and std::cerr. Since I've been using WSTP, I have not been able to spawn the terminal to output text messages. I have created functions to print to the notebook, and these do work at times, but it comes with interpretation of the notebook frontend. Does anybody know how to turn on the terminal as a separate window?

My setup:

  • Linux Mint (fully updated to the latest version)
  • QtCreator with CMake
  • FindMathematica.cmake
  • Mathematica 14.0
  • WSTP interface 4
$\endgroup$
2
  • $\begingroup$ Turns out that starting Mathematica from the terminal actually shows the cout and cerr pipes. $\endgroup$
    – gaohan
    Commented Feb 21 at 15:40
  • $\begingroup$ “I am very happy with the abilities of WSTP.”——According to my tests, even if I only run the simple code RemoteEvaluate[$Version], if I run it several times (immediately after the last run results), wstp will report an error..And don't expect to use Import["/home/yode/img.jpg"] to import image from remote server If img.jpg is larger than 2M $\endgroup$
    – yode
    Commented Mar 14 at 7:31

1 Answer 1

1
$\begingroup$

Turns out that starting Mathematica from the terminal actually shows the cout and cerr pipes.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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