I am trying to use some code from opencv in an r package, using Rcpp to build the package. When I compile the c code on my machine, it works fine. However, when I try to include it in my package, it gives me a bunch of error messages like:

"error: opencv2/core/operations.hpp: No such file or directory"

Does anyone know how to get R to compile the C code as my command line g++ compiler does?

For example, I am using the the following syntax to compile the facedetect.cpp code:

g++ -bind_at_load `pkg-config --cflags opencv` facedetect.cpp -o facedetect `pkg-config --libs opencv` 
The key are the flags that point the compiler to the opencv package. How can I get R to use those same flags when it compiles the C code? Unfortunately I could not find the answer via google or the Writing R Extensions manual. My apologies if I missed something obvious.  Thank you -Solomon 
	[[alternative HTML version deleted]]

