
Last chance! 50% off unlimited learning
Sale ends in
Compile C / C++ / Fortran source files using the compiler configured
by your R Makeconf
file.
make(target = "all", makefile = r_makeconf_path())make_call(cmd = "$(CC)", args = "--version")
make_echo(cmd = "$(CC)")
make_info()
name of output file that you want to make
path to the Makefile
. Defaults to the Makeconf
which
R uses when building R packages.
command to invoke (may be a variable)
additional arguments for cmd
The make
function literally calls make yourfile.o -f /path/to/R/Makeconf
.
This is exactly what R does when building packages and hence the best
way to test if the compiler is working.
Other maketools:
diagnostics
,
pkgconfig
,
r_config
,
rtools
,
sysdeps
# Test the CXX compiler
if(cxx_info()$available){
testprog <- '#include \nint main() {std::cout << "Hello World!";}'
writeLines(testprog, con = 'testprog.cc')
make('testprog')
# Test and cleanup
system('./testprog')
unlink('testprog*', recursive = TRUE)
}
# Run a program from a make variable
make_call('$(CXX)', '--version')
# Where your makeconf is stored:
make_info()
Run the code above in your browser using DataLab