Message Boards Message Boards



Posted 6 years ago
4 Replies
0 Total Likes

This post grew out of the August 2015 thread "ExportString and CreateExecutable" , notably from Ilian Gachevski's helpful replies.

The atch'd notebook comes from (go to "Working with Generated Code") whose example creates an executable. The notebook is the example interspersed with comments that may be useful to some.

The main thing to note is that on my Windows 8.1 system running Mathematica 10.2, this example did NOT work when I used the Visual Studio Community 2015 compiler ( However, thanks to guidance received from a person who remains anonymous, I uninstalled VS2015 and installed Visual Studio 2013 (v12) from the same website. The documentation's example then worked -- the executable was created.

I was told that VS2015 has only recently come out (it's now 10 September 2015) and so apparently there are kinks to work out when used with Mathematica. There is one question, however: when I run testgenerate.exe, I get the Windows box "testgenerate.exe has stopped working..."

Does anyone know what causes this and how can it be avoided? Thanks.


4 Replies

It is crashing because the main program source does not #include "WolframRTL.h".

Posted 6 years ago

Perfect! Now everything works, to include a functioning executable. Thank you (again), Ilian.

What puzzles me now is that for one person (the one who suggested using an earlier version of Visual Studio and not VS2015), a perfectly functional executable was created WITHOUT the CInclude@"WolframRTL.h" command. Yet for me it was essential.

Or perhaps that person observed that the executable had been created and left it at that --(s)he didn't actually run it, whereas I did (although not at first -- I was initially content with seeing that it had been created). That must be it, the only scenario that makes sense. At last we can close this matter -- it was a very instructive (albeit time-consuming) trip.

It's my experience that C code generated by GCC is about 10 times faster than C code generated by Visual Studio, but I haven't been able to use the GCC compiler from Mathematica.

Posted 6 years ago

That's an interesting observation about speed, Frank. I'm using VS simply because another person uses it on Windows, although I had noticed that Wolfram has tested gcc on the MacOSX and Linux versions found at

I'll pass your observation along.

I have no clue why gcc wouldn't work from Mathematica. Maybe this is the start of a new thread? Hopefully so, since your speed observation is pretty compelling.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract