R-beta: linking c++ functions

Kung-Sik Chan kchan at stat.uiowa.edu
Mon Sep 15 02:01:29 CEST 1997


I have written some C++ functions and want to port the functions into
an R library, but got the following error message when I invoked the
library called chaos:

> library(chaos)
/usr/local/lib/R/bin/R.binary: can't resolve symbol 'cout'
/usr/local/lib/R/bin/R.binary: can't resolve symbol '__ls__7ostreamPCc'
/usr/local/lib/R/bin/R.binary: can't resolve symbol 'cout'
/usr/local/lib/R/bin/R.binary: can't resolve symbol '__ls__7ostreamPCc'
/usr/local/lib/R/bin/R.binary: can't resolve symbol '__ls__7ostreamPCc'
/usr/local/lib/R/bin/R.binary: can't resolve symbol '__ls__7ostreamPCc'
/usr/local/lib/R/bin/R.binary: can't resolve symbol 'cout'
/usr/local/lib/R/bin/R.binary: can't resolve symbol '__ls__7ostreamPCc'
/usr/local/lib/R/bin/R.binary: can't resolve symbol 'cout'
/usr/local/lib/R/bin/R.binary: can't resolve symbol '__ls__7ostreamPCc'
/usr/local/lib/R/bin/R.binary: can't resolve symbol '__ls__7ostreamPCc'
Error in dyn.load(system.file("lib", name)) : unable to load shared library "/us
r/local/lib/R/lib/chaos.so"  

In fact, I used in my C++ functions the newmat library which is a library
of matrix classes. The following is the makefile in my sub-dirctory
RHOME/src/library/chaos/src, which seems to compile ok resulting in 
the  chaos.so file.


.cc.o:
        g++ -c $(CFLAGS) -I/usr/include/newmat -I/usr/include/nric -lnewmat -lm $<
LIBNAME=chaos
LD=ld

OBJS=   lyapunov.o

chaos.so:       $(OBJS)
        $(LD) $(SHLIBLDFLAGS) -o $(LIBNAME).so $(OBJS)  \
        -lnewmat -lm

clean:
        @rm -f *.o *.so

realclean:
        @rm -f Makefile *.o *.so  

I'll appreciate suggestions on how to fix the problem. Thanks.

Kung-Sik Chan
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



More information about the R-help mailing list