r - Rcpp - Compile a C++ file with multiple functions -


i have quick question how compile .cpp file multiple function in it. let's have c++ file : functions.cpp

#include <rcpp.h> #include <math.h>       /* pow */ using namespace rcpp;   // [[rcpp::export]]  int function1 (int n, numericmatrix w){  return ....   }   // [[rcpp::export]]  int function2 (int n, numericmatrix w){  return ....   } 

and compile file , able to call both functions. have done it, happens when try load functions.o gives me this":

 error in indl(x, as.logical(local), as.logical(now), ...) :  unable load shared object 'c:/users/functions.o':   loadlibrary failure:  %1 not valid win32 application. 

anybody , idea ?

just use sourcecpp("nameofyourfile.cpp")

if you have no syntax error preventing compilation both function1 , function2 accessible in r session.

literally thousands of such files have been written, , 1 hundred @ disposal on @ the rcpp gallery.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -