R and C++: Rcpp.
The standard way to build interfaces between R and C++ code is to use Rcpp [1,2].
It is possible to directly interface R with low-level C code, This will require a lot of code and knowledge of R internals. Rcpp automates a lot of this. E.g. Rcpp will take care of translating an R vector into a C++ vector.
Rcpp supports both small fragments of C++ code passed on as an R string to more coarse-grained file based approach . For Windows, you need to download the GNU compilers .
If you are new to both Rcpp and to building your own R packages  things may be a bit overwhelming.
Rstudio can help a lot. It supports a lot of very useful tasks:
- Syntax coloring for C++ code.
- Building projects.
- Git version control.
- Documentation tools (rmarkdown and bookdown). My documentation is also a good test: it executes almost all of the code when building the document.
|Editing C++ code in RStudio|
Basically I never have to leave RStudio.
I have added an alternative driver file for my C++ code so I can debug it in Visual Studio. I used it only a few times: most of the time I just used RStudio.
Python and C++: pybind11
pybind11  is in many respects similar to Rcpp, although it requires a little bit more programming to bridge the gap between Python and C++.
In the beginning of the above Youtube video , the presenter compares pybind11 with some of the alternatives:
- SWIG: author of SWIG says: don't use it
- ctypes: call c functions but not c++
- CFFI: call c functions
- Boost.Python: support for older C++ standards, but not much maintained
- pybind11: modern
As with Rcpp, calling the compiler is done through running a build or setup script. For Rcpp I used the GNU compilers, while pybind11/pip install supports the Visual Studio C++ compiler. This also means that if you have little experience with both pybind11 and creating packages, the learning curve may be steep.
- Dirk Eddelbuettel, Seamless R and C++ Integration with Rcpp, Springer, 2013
- Chapter: Rewriting R code in C++, https://adv-r.hadley.nz/rcpp.html
- Hadley Wickham, R packages, O'Reilly, 2015
- Robert Smallshire, Integrate Python and C++ with pybind11, https://www.youtube.com/watch?v=YReJ3pSnNDo