- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我刚刚开始习惯使用 R 中的 Rcpp 包。我通常在使用 Rcpp 时构建一个包。然而,为了调试和测试,我希望能够在不涉及 R 的情况下运行 C++ 代码。因此,我尝试在 C++ 程序中使用 Rccp 类。例子
#include <Rcpp.h>
int main(int argc, const char * argv[])
{
Rcpp::NumericVector vec(0);
return 0;
}
产生以下错误:
Undefined symbols for architecture x86_64:
"_REprintf", referenced from:
Rcpp::Rstreambuf<false>::xsputn(char const*, long) in main-fe5efc.o
Rcpp::Rstreambuf<false>::overflow(int) in main-fe5efc.o
"_R_FlushConsole", referenced from:
Rcpp::Rstreambuf<false>::sync() in main-fe5efc.o
Rcpp::Rstreambuf<true>::sync() in main-fe5efc.o
"_R_GetCCallable", referenced from:
dataptr(SEXPREC*) in main-fe5efc.o
"_R_NilValue", referenced from:
Rcpp::PreserveStorage<Rcpp::Vector<14, Rcpp::PreserveStorage> >::PreserveStorage() in main-fe5efc.o
Rcpp::PreserveStorage<Rcpp::Vector<14, Rcpp::PreserveStorage> >::~PreserveStorage() in main-fe5efc.o
Rcpp::Rcpp_ReleaseObject(SEXPREC*) in main-fe5efc.o
Rcpp::Rcpp_PreserveObject(SEXPREC*) in main-fe5efc.o
"_R_PreserveObject", referenced from:
Rcpp::Rcpp_PreserveObject(SEXPREC*) in main-fe5efc.o
"_R_ReleaseObject", referenced from:
Rcpp::Rcpp_ReleaseObject(SEXPREC*) in main-fe5efc.o
"_Rf_allocVector", referenced from:
Rcpp::Vector<14, Rcpp::PreserveStorage>::Vector(int const&) in main-fe5efc.o
"_Rf_isNull", referenced from:
Rcpp::Rcpp_ReplaceObject(SEXPREC*, SEXPREC*) in main-fe5efc.o
"_Rf_xlength", referenced from:
void Rcpp::internal::r_init_vector<14>(SEXPREC*) in main-fe5efc.o
"_Rprintf", referenced from:
Rcpp::Rstreambuf<true>::xsputn(char const*, long) in main-fe5efc.o
Rcpp::Rstreambuf<true>::overflow(int) in main-fe5efc.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我使用以下命令编译:
clang++ main.cpp -I/Library/Frameworks/R.framework/Resources/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include"
我在 Mac 上使用 Xcode 6。寻找解决方案我已经从源代码安装了 Rcpp 和 RInside,但它没有解决问题。感谢您的帮助!
最佳答案
Rcpp 是 R 的扩展。没有 R,它根本无法工作。
你只是做了一个大胆的假设,认为你可以做你正在做的事。事实证明,该假设是不正确的。
如果您想构建新的“主要”程序,您最接近的选择是使用 RInside它嵌入了 R。从它的大量示例开始,特别是在 examples/standard/
中。
关于c++ - 编译器错误 : Undefined symbols for architecture x86_6 when using Rccp classes.,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32276733/
我有一个通过 Rcpp 的函数来反转整数 #include using namespace Rcpp; //' Reverse an integer //' //' @param x A singl
我开发了代码,可以围绕大型矩阵移动元素以模拟水文条件。这部分代码是一个函数,在一个小时的模拟中被多次调用,而当我试图对 30 年的数据进行建模时,最终会耗费大量时间。 在名为 flowingrunof
我正在尝试编写一个 .cpp,它接受一个输入 vector 并输出一个包含输入 vector 中所有可能组合的两列数据帧。我的输出给出了所需的值,但不是作为数据帧。我在 .cpp 文件中更改了什么才能
我知道 Rcpp 是一个用于 C++ 和 R 之间集成的 R 包。我有一个为此使用 Rcpp 的代码。但我希望直接使用 C++ 代码。是否有可能像任何普通的 C++ STL 一样获取 Rcpp,以便我
我刚刚开始习惯使用 R 中的 Rcpp 包。我通常在使用 Rcpp 时构建一个包。然而,为了调试和测试,我希望能够在不涉及 R 的情况下运行 C++ 代码。因此,我尝试在 C++ 程序中使用 Rccp
我是一名优秀的程序员,十分优秀!