【发布时间】:2015-01-08 15:39:00
【问题描述】:
我很难让 Rcpp 在我的 Windows 上运行。我下载了 Rtools 并且我已将路径更改为
c:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin;c:\Program Files\R\R-3.0.2\bin\x64;[其他]
然后我获取了一个非常简单的 c++ 文件 (new.cpp),如下所示
include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
int timesTwo(int x) {
return x * 2;
}
然后我继续使用 Powershell,并按照无缝 R 和 C++ 的建议 D. Eddelbuettel 与 Rcpp 集成(第 2 章)我尝试编译代码
PS C:\Users\RXD308\pgmcpp> PKG_CXXFLAGS='Rscript -e 'Rcpp:::CxxFlags()''\ PKG_LIBS='Rscript -e 'Rcpp:::LdFlags()''\ RCMD SHLIB new.cpp
获取错误
An expression was expected after '('.
At line:1 char:43
+ PKG_CXXFLAGS='Rscript -e 'Rcpp:::CxxFlags( <<<< )''\ PKG_LIBS='Rscript -e 'Rcpp:::LdFlags()''\ RCMD SHLIB new.cpp
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpectedExpression
最后两件事
我已启动 MinGW 并在我的计算机上工作 (g++ 4.6)
-
我认为我在 powershell 中的 R 命令存在重大问题。事实上,当我访问 powershell 并输入“R --version”时,我得到了这个错误
Invoke-History : Cannot locate history for commandline --version. At line:1 char:2 + R <<<< --version + CategoryInfo : ObjectNotFound: (--version:String) [Invoke-History], ArgumentException + FullyQualifiedErrorId : InvokeHistoryNoHistoryForCommandline,Microsoft.PowerShell.Commands.InvokeHistoryCommand
【问题讨论】:
标签: c++ r windows powershell rcpp