I'm trying to use a function created using Rcpp package within Rmarkdown document. But the following results in an error:
```{Rcpp firstChunk}
Rcpp::IntegerVector doubleMe(Rcpp::IntegerVector x) {
return x + x;
}
```
C:/Rtools/mingw_64/bin/g++ -I"C:/Users/JAKMIC~1/DOCUME~1/R/R-35~1.1/include" -DNDEBUG -I"C:/Users/jakmicha1/Documents/R/R-3.5.1/library/Rcpp/include" -I"C:/Users/jakmicha1/AppData/Local/Temp/RtmpQBQexm/sourceCpp-x86_64-w64-mingw32-0.12.18" -O2 -Wall -mtune=generic -c file17ec52d61f75.cpp -o file17ec52d61f75.o file17ec52d61f75.cpp:1:1: error: 'Rcpp' does not name a type Rcpp::IntegerVector doubleMe(Rcpp::IntegerVector x) { ^ make: *** [C:/Users/JAKMIC~1/DOCUME~1/R/R-35~1.1/etc/x64/Makeconf:215: file17ec52d61f75.o] Error 1 Error in Rcpp::sourceCpp(code = "Rcpp::IntegerVector doubleMe(Rcpp::IntegerVector x) {\n return x + x;\n}") : Error 1 occurred building shared library.
What may be a cause and how can I solve it?
Edit:
Thanks for all the replies. The code seems to work ok while running chunks. There is an error while knitting though.
---
title: "title"
output: pdf_document
---
```{Rcpp firstChunk}
#include <Rcpp.h>
//[[Rcpp::export]]
Rcpp::IntegerVector double2Me(Rcpp::IntegerVector x) {
return x + x;
}
```
```{r callFirstChunkInR}
double2Me(c(2, 2))
```
# In command 'system(cmd)': 'make' not found
# Quitting from lines 7-13 (title.Rmd)
# Error in command '(function (file = "", code = NULL, env = globalenv(), embeddedR = TRUE, ':
# Error 1 occurred building shared library.
# Calls: <Anonymous> ... block_exec -> in_dir -> engine -> do.call -> <Anonymous>
I'm using Rmarkdown 1.10 within RStudio 1.1.456 on Windows 7 and Rcpp_0.12.19. Any ideas?

C:/Rtools, c.f. thecoatlessprofessor.com/programming/… - coatlessRtoolstries to insert on your path are at the beginning then. - coatless