[Rcpp-devel] Rcpp/ Boost linking problem

Steven McKinney smckinney at bccrc.ca
Wed Sep 9 23:19:06 CEST 2015

Have you tried setting flags in HOME/.R/Makevars as described in


Depending on your operating system version, there are some variants for HOME/.R/Makevars file naming, described in the R Admin manual, so give that a careful read and see if that lets you accomplish your compilation and linking.


Steven McKinney

Molecular Oncology and Breast Cancer Program
British Columbia Cancer Research Centre

From: rcpp-devel-bounces at lists.r-forge.r-project.org <rcpp-devel-bounces at lists.r-forge.r-project.org> on behalf of Diego Monteiro <dvm1607 at gmail.com>
Sent: September 9, 2015 1:55 PM
To: rcpp-devel at lists.r-forge.r-project.org
Subject: [Rcpp-devel] Rcpp/ Boost linking problem

Good Evening.

I am pretty new to this programming universe, but I was given a task to create an R/C++ package.

I am trying to link a third-party library to my R/C++ code using Rcpp 0.12.0 , I have successfully used other third party libraries on my R/C++, but when I try to use this one that uses boost my R gives me the following error:

** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared object '/home/diego/R/x86_64-pc-linux-gnu-library/3.2/TesteTerralib/libs/TesteTerralib.so':
  /home/diego/R/x86_64-pc-linux-gnu-library/3.2/TesteTerralib/libs/TesteTerralib.so: undefined symbol: _ZN5boost6system15system_categoryEv
Error: loading failed
Execution halted
ERROR: loading failed

I have boost 1.59.0 installed, but apparently it could not be linked.
Searching online I have found that maybe adding the flag -lboost_system to the g++ it would work, but I don't know how to add this flag when using RStudio nor just R in the terminal. Could anybody tell me what should I do?

Best Regards

More information about the Rcpp-devel mailing list