(Please don't post twice.) On 7 April 2011 at 05:20, deqiang sun wrote: | Hi all, | | Could someone help me on compilation of the RInside/inst/examples/standard/rinside_sample0.cpp. This example is the project Rinside0 created by eclipse. | | And here is the error message for build. | | **** Build of configuration Debug for project Rinside0 **** | make all | Building file: ../src/Rinside0.cpp | Invoking: GCC C++ Compiler | g++ -I/home/deqiangs/workspace/RInside -I/home/deqiangs/workspace/Rcpp -I/home/deqiangs/workspace/RInside/inst/include -I/home/deqiangs/workspace/Rcpp/inst/include -I/usr/local/lib64/R/include -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/Rinside0.d" -MT"src/Rinside0.d" -o"src/Rinside0.o" "../src/Rinside0.cpp" | Finished building: ../src/Rinside0.cpp | | Building target: Rinside0 | Invoking: GCC C++ Linker | g++ -o"Rinside0" ./src/Rinside0.o
No linking! | ./src/Rinside0.o: In function `main': | ~/workspace/Rinside0/Debug/../src/Rinside0.cpp:17: undefined reference to `RInside::RInside(int, char const* const*, bool)' | ~/workspace/Rinside0/Debug/../src/Rinside0.cpp:19: undefined reference to `RInside::operator[](std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' | ~/workspace/Rinside0/Debug/../src/Rinside0.cpp:21: undefined reference to `RInside::parseEvalQ(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' | ~/workspace/Rinside0/Debug/../src/Rinside0.cpp:23: undefined reference to `RInside::~RInside()' | ./src/Rinside0.o: In function `Rcpp::wrap(char const*)': | ~/workspace/Rcpp/inst/include/Rcpp/internal/wrap.h:781: undefined reference to `Rf_mkString' | ./src/Rinside0.o: In function `bool Rcpp::Environment::assign<char [15]>(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const (&) [15]) const': | ~/workspace/Rcpp/inst/include/Rcpp/Environment.h:270: undefined reference to `Rcpp::Environment::assign(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, SEXPREC*) const' | ./src/Rinside0.o:(.gcc_except_table+0x10): undefined reference to `typeinfo for Rcpp::binding_is_locked' | collect2: ld returned 1 exit status | make: *** [Rinside0] Error 1 This is obviously an issue with the linker so you have to find out how you tell Eclipse to tell gcc (and hence ld) about the libraries. | How should I setup the environment so that the compiler/linker work seamlessly? I can not find any documentation on this. It all works -- using the supplied Makefile. You chose not to use it, you need to 'port' it to your preferred build tool. The relevant lines are LDLIBS := $(RLDFLAGS) $(RRPATH) $(RBLAS) $(RLAPACK) $(RCPPLIBS) $(RINSIDELIBS) as well as all the lines filling the variables uses here. When I build first example, it ends up being (and note that paths etc depend on local installations) edd@max:~/svn/rinside/pkg/inst/examples/standard$ make rinside_sample0 g++ -I/usr/share/R/include -I/usr/local/lib/R/site-library/Rcpp/include -I"/usr/local/lib/R/site-library/RInside/include" -O3 -pipe -g -Wall rinside_sample0.cpp -L/usr/lib64/R/lib -lR -lblas -llapack -L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/local/lib/R/site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/site-library/RInside/lib -o rinside_sample0 edd@max:~/svn/rinside/pkg/inst/examples/standard$ You could always use make if the Eclipse build tool cannot be tamed... Dirk -- Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel