c++rmacosrcpp

Rcpp error, learning Rcpp and C++ on mac


I've decided to start learning Rcpp and C++ so I can make aspects of my R code faster. For a start I'm using the tutorial hadley has in the devtools wiki. I have a c++ compiler on this machine in that it's a mac and I have xcode installed on it - I'm told that puts the c++ compiler on the machine. I try to run the first example:

cppFunction('
            int one(){
            return 1;
            }
            ')

However, what happens is:

    sh: make: command not found

Error in sourceCpp(code = code, env = env, rebuild = rebuild, showOutput = showOutput,  : 
  Error 1 occurred building shared library.

I'm guessing I have a setup issue, but what to do I'm not sure. For a general C++ knowlege I've started reading Absolute C++ by Savitch, which so far does not actually tell you anything about setting up a machine with compiler etc, because you're instructed to use something called MyProgrammingLab which just tells you if you got the answer right or not and gives output, you don't go through the compilation or anything like that.

Thanks, Ben W.


Solution

  • Errors of the type sh: foo: command not found are pretty obvious. You are lacking the make command. Install it, and try again. Or if Xcode installs it outside of the path, add it to the path.