Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/127.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 怀疑运行c++;使用R的代码_C++_R_Vector - Fatal编程技术网

C++ 怀疑运行c++;使用R的代码

C++ 怀疑运行c++;使用R的代码,c++,r,vector,C++,R,Vector,我试图使用R处理c++代码,但我不能使用其他库中的对象 #include <Rcpp.h> using namespace Rcpp; // [[Rcpp::export]] int fun(int x, int n) { for(int i=0;i<=n;i++){ x=x+n; } return x; } #包括 使用名称空间Rcpp; //[[Rcpp::导出]] int fun(int x,int n){ 对于(int i=0;请参阅本页向

我试图使用R处理c++代码,但我不能使用其他库中的对象

#include <Rcpp.h>
using namespace Rcpp;

// [[Rcpp::export]]
int fun(int x, int n) {
   for(int i=0;i<=n;i++){
    x=x+n;
   }
   return x;
}
#包括
使用名称空间Rcpp;
//[[Rcpp::导出]]
int fun(int x,int n){

对于(int i=0;请参阅本页向量输入标量输出部分的代码:@G.Grothendieck非常感谢!!