I just start playing around with C++ and how to combine it with Emacs. This website on cpp-programming and Intro to C++ are the starting point for me. The extended aim is to be able to write some C++ codes that can be part of R.
Standard Hello World!
.
#include <iostream>
using namespace std;
int main(){
cout << "Hello World!" << endl;
return 0;
}
To compile this basic code in Emacs then use make
with the following:
M-x compile
orSPC c c
in Doom.- type
make basic
. This will useMakefile
to findbasic.cpp
file to compile and useg++
. - An executable file named
basic
will be produced. - Run the file eg.
./basic
- If you alter the file then you can
M-x recompile
orSPC c C
A nice description on using Makefile
can also be found here doc.ic.ac.uk