'How to point gcc to the include header files in rtools40 when installing R package from source - Windows?

Installing an older version of data.table, or any package from source gives the error below.

How do i tell the compiler where to look for the header files?

*** arch - i386
"C:/rtools40/mingw32/bin/"gcc  -I"//vcfs01/gpo-usersajakubek/Documents/R/R-4.1.2/include" -DNDEBUG       -fopenmp   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c assign.c -o assign.o
In file included from assign.c:1:
data.table.h:1:10: fatal error: R.h: No such file or directory
 #include <R.h>
          ^~~~~
compilation terminated.
make: *** [//vcfs01/gpo-users$/ajakubek/Documents/R/R-4.1.2/etc/i386/Makeconf:238: assign.o] Error 1
ERROR: compilation failed for package 'data.table'
* removing '\\vcfs01/gpo-users$/ajakubek/Documents/R/R-4.1.2/library/data.table'
Warning message:
In i.p(...) :
  installation of package ‘C:/Users/ajakubek/AppData/Local/Temp/Rtmp27hEuu/remotes4eac12ed631f/data.table’ had non-zero exit status

I am guessing its in the Makeconf file so i guess my question should be which flags do i use?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source