Hi there friends,
I'd like to write and run some C++ programs (as part of a presentation) from within Mathematica. I've seen a simple example in the documentation - using CreateExecutable - but I didn't succeed. Is it something, maybe settings, that I have to do first?
I am using an almost 5 years old MacBook Pro with Mac OS High Sierra and I write C++ programs using X Code 10.0.
Here's what I've got when I tried the example in the documentation :
In[23]:= Needs["CCompilerDriver`"]
In[24]:= hello = CreateExecutable["
#include <stdio.h>
int main(){
printf(\"hello world\\n\");
}
", "hello"]
During evaluation of In[24]:= CreateExecutable::cmperr: Compile error: xcrun: error: active developer path ("/Applications/Xcode 2.app/Contents/Developer") does not exist >>
Out[24]= $Failed
In[25]:= Import["!" <> QuoteFile[hello], "Text"]
During evaluation of In[25]:= StringJoin::string: String expected at position 2 in !<>QuoteFile($Failed). >>
During evaluation of In[25]:= Import::chtype: First argument !<>QuoteFile($Failed) is not a valid file, directory, or URL specification. >>
Out[25]= $Failed
Thank you, :)