4

Windows XP プラットフォームの R 2.14.2 で Rcpp を使用しようとしています。私が知る限り、Rcpp を動作させるために推奨されるすべての手順に従いました。

  1. C:\R\R-2.14.2 というディレクトリに R をインストールしました。
  2. Rtools の最新バージョンをディレクトリ C:\R\Rtools にインストールしました。
  3. 環境 PATH を次のように設定します (まったく同じ順序で)。

C:\R\Rtools\bin;C:\R\Rtools\gcc-4.6.3\bin;
C:\R\R-2.14.2\bin\i386;C:\WINDOWS;C:\WINDOWS\system32

これらすべてにもかかわらず、R でテスト例を実行して Rcpp が機能するかどうかを確認しようとすると、エラー メッセージが表示されました。テスト例は次のとおりです。

library(Rcpp)
library(inline)

body <- '
NumericVector xx(x);
return wrap( std::accumulate( xx.begin(), xx.end(), 0.0));'

add <- cxxfunction(signature(x = "numeric"), body, plugin = "Rcpp")

x <- 1
y <- 2
res <- add(c(x, y))
res

上記の R コードを実行しようとした結果、R によって生成されたかなり長いエラー メッセージを次に示します。私が間違っていることと、Rcppが機能することを確認するために他に何をする必要があるかを誰かに教えてもらえますか?

cygwin warning:
MS-DOS style path detected: C:/R/R-214~1.2/etc/i386/Makeconf
Preferred POSIX equivalent is: /cygdrive/c/R/R-214~1.2/etc/i386/Makeconf
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
g++.exe: error: C:/Documents: No such file or directory
g++.exe: error: and: No such file or directory
g++.exe: error: Settings/dv6110ca/My: No such file or directory
g++.exe: error: Documents/R/win-library/2.14/Rcpp/lib/i386/libRcpp.a: No such file  
or directory

ERROR(s) during compilation: source code errors or compiler configuration errors!

Program source:
1: 
2: // includes from the plugin
3: 
4: #include <Rcpp.h>
5: 
6: 
7: #ifndef BEGIN_RCPP
8: #define BEGIN_RCPP
9: #endif
10: 
11: #ifndef END_RCPP
12: #define END_RCPP
13: #endif
14: 
15: using namespace Rcpp;
16: 
17: 
18: // user includes
19: 
20: 
21: // declarations
22: extern "C" {
23: SEXP file684203c3ec2( SEXP x) ;
24: }
25: 
26: // definition
27: 
28: SEXP file684203c3ec2( SEXP x ){
29: BEGIN_RCPP
30: 
31: NumericVector xx(x);
32: return wrap( std::accumulate( xx.begin(), xx.end(), 0.0));
33: END_RCPP
34: }
35: 
36: 
Error in compileCode(f, code, language = language, verbose = verbose) : 
Compilation ERROR, function(s)/method(s) not created! cygwin warning:
MS-DOS style path detected: C:/R/R-214~1.2/etc/i386/Makeconf
Preferred POSIX equivalent is: /cygdrive/c/R/R-214~1.2/etc/i386/Makeconf
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
g++.exe: error: C:/Documents: No such file or directory
g++.exe: error: and: No such file or directory
g++.exe: error: Settings/dv6110ca/My: No such file or directory
g++.exe: error: Documents/R/win-library/2.14/Rcpp/lib/i386/libRcpp.a: No such file or  
directory
4

3 に答える 3

4

パス名にスペースを含むディレクトリに R をインストールしないでください。その推奨事項は、私が覚えているように、「R for Windows FAQ」にあります。

私の個人的な好みは、常にc:\opt\R-current\バージョン管理されたデフォルト パスではありません。

于 2012-03-19T03:36:13.737 に答える
3

エラーは、投稿したメッセージの最後の 5 行で説明されています。

g++.exe: error: C:/Documents: No such file or directory
g++.exe: error: and: No such file or directory
g++.exe: error: Settings/dv6110ca/My: No such file or directory
g++.exe: error: Documents/R/win-library/2.14/Rcpp/lib/i386/libRcpp.a: No such file or  
directory

g++.exeというファイルを探していますlibRcpp.aが、ファイルは名前にスペースが含まれるフォルダーにあります。特に、コンピューターでは、ファイルは次のフォルダーにあります。

C:/Documents and Settings/dv6110ca/My Documents/R/win-library/2.14/Rcpp/lib/i386/libRcpp.a

フォルダーへのパスには 3 つのスペースが含まれています ( と の間Documents、 とandの間、andSettingsの間)。何らかの方法で、コンパイラ/リンカーはそのスペースを好みません。MyDocuments

于 2012-10-07T13:18:43.173 に答える
2

私はRcppの設定で同じ問題を抱えていました。Rをアンインストールしてから再インストールして、Rcppと互換性のあるセットアップを作成したようです。これを行うと、R は以前のインストールと同じフォルダーにパッケージをインストールします。R をアンインストールした後、パッケージを保持するフォルダーを必ず削除してください。私の Windows 7 マシンでは、このフォルダーはC:/Users/Chandler/R. このフォルダーを削除します。次にRを再インストールします。新しいパッケージが新しいRフォルダーにインストールされていることを確認してくださいC:\R\R-2.14.2\library。これにより、Dirk が前述したフォルダーの場所にあるスペースの問題が解消されます。

また、パスが「R インストールと管理」マニュアルの付録 D の例と同じであることを確認してください。2.14.2 ではなく最新バージョンの R を使用している場合は、このマニュアルに従うのが最も簡単です。

注: Rcpp が機能していても、まだ cygwin の警告が表示されます。

于 2012-07-05T17:54:25.453 に答える