Linking libraries in R


Would be anyone ready to suggest any options how to link C++ library to C++ package in R studio. I have this igraph library which i need for integration of algorithm(igraph C,C++ core). I have tried to link it with makevars.

This is the run statement from VS code:

g++ -std=c++17 -O3 -march=native -DNDEBUG -I/usr/local/include/igraph -Iinclude -L/usr/local/lib -o a.out main.cpp -ligraph -lm -lstdc++ -lgomp -lpthread

And this is directory path to static library:



I really need advice, how to do it or some help with it because this is my diploma thesis.

  1. How can i link library in R studio, static, dynamic and then in description folders is comand linkingTo with which i have included BoostHeaders i can give commands to makevars, but it would be really nice if someone could explain me one or more solutions that would work.

I would ask for a explanation of solution that would help me and/or help writting makevars.