[Rcpp-devel] 'Symbol not found' error
Steve Jaffe
sjaffe at riskspan.com
Thu Oct 3 23:17:47 CEST 2013
If your code really is as written:
void print_state( double outtime, statelist &state,
std::ofstream outfile,
arma::mat &printmatrix)
I'd be suspicious of std::ofstream outfile passed by value not reference.
The copy constructor is private so I don't see how this would compile.
Which would explain why the library is missing.
But if that were the case you should have compiler errors; could they have been overlooked?
Steve
------------------------------
Message: 7
Date: Thu, 3 Oct 2013 10:19:44 -0700
From: Noam Ross <noam.ross at gmail.com>
To: rcpp-devel at lists.r-forge.r-project.org
Subject: [Rcpp-devel] 'Symbol not found' error
Message-ID:
<CA+Ygi5nHSdBYmXB9eZ_E58QAOYDbY8twm_otGM4r1DRWh619kw at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
I am getting the following error when attempting to load a package built
using Rcpp with Rstudio's build tools:
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object
'/home/noamross/R/x86_64-pc-linux-gnu-library/3.0/sodi/libs/sodi.so':
/home/noamross/R/x86_64-pc-linux-gnu-library/3.0/sodi/libs/sodi.so:
undefined symbol:
_Z11print_statedR9statelistRSt14basic_ofstreamIcSt11char_traitsIcEERN4arma3MatIdEE
This appears to refer to my print_state function:
#include <fstream>
#include <RcppArmadillo.h>
#include "data_structures.h"
void print_state(double outtime, statelist &state, std::ofstream
outfile, arma::mat &printmatrix) {
printmatrix.col(0).fill(outtime);
printmatrix.col(1) = arma::conv_to<arma::vec>::from(state.ID);
printmatrix.col(2) = state.X;
printmatrix.col(3) = state.Y;
printmatrix.col(4) = arma::conv_to<arma::vec>::from(state.S);
printmatrix.col(5) = arma::conv_to<arma::vec>::from(state.I);
arma::mat p = printmatrix(arma::span(0, state.treeindex), arma::span(0, 5));
p.save(outfile, arma::csv_ascii);
}
statelist is custom struct with default constructors/deconstructors (in
data_structures.h). print_state is also declared in print_state.h:
extern void print_state(double outtime, statelist &state,
std::ofstream &outfile, arma::mat &printmatrix);
print_state is only called once in my code, in a loop, in a function in a
different file (run_sodi in run_sodi.cpp), which has #include
"print_state.h":
if (state.time >= *next_record) {
print_state(*next_record, state, outfile, printmatrix);
++next_record;
}
Here next_record is defined previously in run_sodi as NumericVector::iterator
next_record = times.begin();. If I comment out the above print_state call
and re-compile, the package will load.
I've tried this compiling using both g++ and clang++ on linux and OSX
machines, respectively, with the same results.
All this code found at https://github.com/noamross/sodi/tree/Rcpp-Dev/src
Any ideas where to hunt this down? Thanks!
Noam Ross
Graduate Group in Ecology
Department of Environmental Science and Policy
University of California at Davis
+1.646.244.0484
http://www.noamross.net/
twitter: @noamross
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20131003/0b0a3f6e/attachment.html>
------------------------------
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel at lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
End of Rcpp-devel Digest, Vol 48, Issue 8
*****************************************
More information about the Rcpp-devel
mailing list