What causes the two error messages below? One says to convert code to DOS format – but doesn’t Mathematica pump out C99-standard code? Is this fix as simple as specifying some option to CreateExecutable? Notice that the ExportString output is atch’d (there’s a renegade leading quote).
Maybe there’s a known problem with the installed C compiler. Maybe the first message causes the other. No doubt user-error is the culprit but I don’t know.
Thanks.
Bruce
The code is:
Needs@"CCompilerDriver`";
CCompilers[]
g=Compile[{x},x^2];
cCode=ExportString[g,"C"]; (* code is atch'd as CCode.txt *)
CreateExecutable[cCode,"mine"]
CreateExecutable::cmperr: Compile error: C:\Users\Bruce\AppData\Roaming\Mathematica\SystemFiles\LibraryResources\Wind\[Ellipsis] format detected: please convert the source file to either DOS or UNIX format >>
CreateExecutable::cmperr: Compile error: C:\Users\Bruce\AppData\Roaming\Mathematica\SystemFiles\LibraryResources\Wind\[Ellipsis] file: 'm-dde41816-6467-4e82-b364-babb0f35cfd0.h': No such file or directory >>
The Mac line endings shouldn’t be there, it sounds like a bug.
The second error message is expected, because there is no header (.h) file generated. Also, to make a standalone executable you would need to supply an appropriate main() function and link to appropriate runtime libraries. See the following tutorial for a couple of examples: