I get a linker error saying that symbol(s) cannot be found when I try to compile an RInside sample file with g++. Any assistance would be appreciated.
R version 2.13.1 is installed on Mac OS X 10.5. Rcpp and RInside include files have been copied to the usr/include directory. R headers and libraries have been included using the -I and -L modifiers of g++ as shown:
$g++ -I/Library/Frameworks/R.framework/Headers -L/Library/Frameworks/R.framework/Libraries rinside_sample0.cpp
The rinside_sample0.cpp file is a sample provided with the RInside package, shown below:
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8; -*-
//
// Simple example showing how to do the standard 'hello, world' using embedded R
//
// Copyright (C) 2009 Dirk Eddelbuettel
// Copyright (C) 2010 Dirk Eddelbuettel and Romain Francois
//
// GPL'ed
#include <RInside.h> // for the embedded R via RInside
int main(int argc, char *argv[]) {
RInside R(argc, argv); // create an embedded R instance
R["txt"] = "Hello, world!\n"; // assign a char* (string) to 'txt'
R.parseEvalQ("cat(txt)"); // eval the init string, ignoring any returns
exit(0);
}
When I attempt to compile with g++ I get an error, shown below:
ld: symbol(s) not found for architecture x86_64
Can someone tell me what I'm doing wrong and how to fix it? Any assistance would be appreciated.