[Rd] unable to load shared object - opencv

From: niandra <gianluca.mastrantonio_at_yahoo.it>
Date: Thu, 08 Nov 2012 12:19:33 -0800 (PST)

Hi all

i'm trying to use the opencv's function into R.

i wrote a simple script, just for try to understand how use c++ in R, it loads an image and write it with a different name (i know it ), and then write "Hello, World". The file is names prova2.cpp (is the first time i try to use c++ )

#include <stdio.h>
#include <opencv/cv.h>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv/highgui.h>
#include <opencv/cv.h>
#include <R.h>
#include <Rinternals.h>

extern "C" SEXP provaR(void) {
cv::Mat gravit;
Rprintf("Hello, World!nn");
return R_NilValue;

Now in the terminal i type R CMD SHLIB prova2.cpp to create the file prova2.so and this happen without error.

In R i type dyn.load("prova2.so") and get this error:

Errore in dyn.load("prova2.so") :
  unable to load shared object

dlopen(/Users/niandra/Desktop/statistico/r/builtpack/ProvaScript/prova2.so, 6): Symbol not found: __ZN2cv11_InputArrayC1ERKNS_3MatE   Referenced from:
/Users/niandra/Desktop/statistico/r/builtpack/ProvaScript/prova2.so   Expected in: flat namespace
 in /Users/niandra/Desktop/statistico/r/builtpack/ProvaScript/prova2.so

I understand that the problem is because i should tell R where to find the opencv library, but i really don't know how do it.

View this message in context: http://r.789695.n4.nabble.com/unable-to-load-shared-object-opencv-tp4648958.html
Sent from the R devel mailing list archive at Nabble.com.

R-devel_at_r-project.org mailing list
Received on Thu 08 Nov 2012 - 20:25:08 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 09 Nov 2012 - 23:10:51 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive