Hi,
I was following this example, with some modifications (code below), but it's not working. I checked the temporary files directory and, while the CreateExecutable[] works, creating the .c and .exe files, the executable file is deleted before the Import[] call.
I'm running Windows 10 x64, Mathematica 9 and MinGW/gcc compiler.
Needs["CCompilerDriver`GenericCCompiler`"]
programSource = StringJoin[
"#include<stdio.h>\n",
"int main(){\n",
" printf(\"Hello MinGW world.\\n\");\n",
"}\n"
];
targetDir = NotebookDirectory[] <> "temp\\";
tempFilesDir = TargetDir;
greeter = CreateExecutable[
programSource,
"hiworld",
"Compiler" -> GenericCCompiler,
"CompilerInstallation" -> "C:/MinGW",
"CompilerName" -> "gcc.exe",
"ShellOutputFunction" -> Print,
"TargetDirectory" -> targetDir,
"WorkingDirectory" -> tempFilesDir,
"Debug" -> True,
"CleanIntermediate" -> False
]
Import["!\"" <> greeter <> "\"", "Text"]
The notebook's output is (where the notebook directory is D:\wkdr\tem-lista3\samples):
D:\wkdr\tem-lista3\samples\temp>C:\MinGW\bin\gcc.exe -o "D:\wkdr\t\
em-lista3\samples\temp\hiworld.exe" -g -I"C:\Program Files\Wolfram \
Research\Mathematica\9.0\SystemFiles\IncludeFiles\C" -I"C:\Program \
Files\Wolfram \
Research\Mathematica\9.0\SystemFiles\Links\MathLink\DeveloperKit\W\
indows-x86-64\CompilerAdditions\mldev64\include" "D:\wkdr\t\
em-lista3\samples\temp\hiworld.c" -L"C:\Program Files\Wolfram \
Research\Mathematica\9.0\SystemFiles\Links\MathLink\DeveloperKit\W\
indows-x86-64\CompilerAdditions\mldev64\lib" -L"C:\Program \
Files\Wolfram \
Research\Mathematica\9.0\SystemFiles\Libraries\Windows-x86-64" \
2>&1
"D:\\wkdr\\tem-lista3\\samples\\temp\\hiworld.exe"
I executed the CreateExecutable generated output command through Windows' cmd and everything worked fine, including the Import function.
Anyone have any idea?
Regards, David.