错误:包的编译失败 - 对“PackageName_rcpp_hello”的未定义引用

时间:2018-04-12 16:00:56

标签: r rcpp

我正在尝试构建一个包但Cpp位导致错误。这个包非常类似于另一个也有一个cpp位,我确实设法构建它没有问题。 我检查了通常的错误,如:

  • 描述中没有链接到转义为here
  • 删除src /中的xxx.o和xxx.so文件并尝试编译 RccpExports.R为here
  • 我试过了Compile(".")tools::package_native_routine_registration_skeleton(".")虽然我 真的不明白他们的意思......

错误

* installing to library 'C:/Program Files/R/R-3.4.0/library'
* installing *source* package 'PackageName' ...
** libs
c:/Rtools/mingw_64/bin/g++  -I"C:/PROGRA~1/R/R-34~1.0/include" -DNDEBUG  -I"C:/Program Files/R/R-3.4.0/library/Rcpp/include"   -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c RcppExports.cpp -o RcppExports.o
c:/Rtools/mingw_64/bin/gcc  -I"C:/PROGRA~1/R/R-34~1.0/include" -DNDEBUG  -I"C:/Program Files/R/R-3.4.0/library/Rcpp/include"   -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -std=gnu99 -mtune=core2 -c init.c -o init.o
c:/Rtools/mingw_64/bin/g++  -I"C:/PROGRA~1/R/R-34~1.0/include" -DNDEBUG  -I"C:/Program Files/R/R-3.4.0/library/Rcpp/include"   -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c rcpp_hello.cpp -o rcpp_hello.o
c:/Rtools/mingw_64/bin/g++ -shared -s -static-libgcc -o PackageName.dll tmp.def RcppExports.o init.o rcpp_hello.o -Ld:/Compiler/gcc-4.9.3/local330/lib/x64 -Ld:/Compiler/gcc-4.9.3/local330/lib -LC:/PROGRA~1/R/R-34~1.0/bin/x64 -lR
init.o:init.c:(.rdata+0x28): undefined reference to `PackageName_rcpp_hello'
collect2.exe: error: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 'PackageName'
* removing 'C:/Program Files/R/R-3.4.0/library/PackageName'

Exited with status 1.

我的会议详情:

R version 3.4.0 (2017-04-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Rstudio: 1.1.383
Rcpp: Rcpp_0.12.12

0 个答案:

没有答案