C++ R版本4.0.0,OS X Catalina,Rcpp安装

C++ R版本4.0.0,OS X Catalina,Rcpp安装,c++,r,xcode,macos,C++,R,Xcode,Macos,我知道很多人在OS X Catalina(10.15.4)上安装Rcpp时遇到困难。我似乎发现了一个新问题 我的错误与我的几乎相同 但是,我使用的是R版本4.0.0(没有倒退),可以修复吗 长版本 我遵照这些指示: 我删除了旧文件 我重新安装了Xcode命令行工具 gcc--版本返回: 我安装了gfortran 8.2 我去运行“快速检查”hello_world.cpp 在R中: 我将运行hello_world.cpp示例(在RStudio 1.2.5033中)。。。我得到: >

我知道很多人在OS X Catalina(10.15.4)上安装Rcpp时遇到困难。我似乎发现了一个新问题

我的错误与我的几乎相同

但是,我使用的是R版本4.0.0(没有倒退),可以修复吗

长版本

我遵照这些指示:

  • 我删除了旧文件
  • 我重新安装了Xcode命令行工具
  • gcc--版本返回:
  • 我安装了gfortran 8.2
  • 我去运行“快速检查”hello_world.cpp
在R中:

我将运行hello_world.cpp示例(在RStudio 1.2.5033中)。。。我得到:

> Rcpp::sourceCpp('Downloads/helloworld.cpp')
In file included from helloworld.cpp:1:
In file included from /Users/Justin/Library/R/4.0/library/RcppArmadillo/include/RcppArmadillo.h:31:
In file included from /Users/Justin/Library/R/4.0/library/RcppArmadillo/include/RcppArmadilloForward.h:26:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/RcppCommon.h:29:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/Rcpp/r/headers.h:67:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/Rcpp/platform/compiler.h:100:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:314:9: error: no member named 'signbit' in the global namespace
using ::signbit;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:315:9: error: no member named 'fpclassify' in the global namespace
using ::fpclassify;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:316:9: error: no member named 'isfinite' in the global namespace; did you mean 'finite'?
using ::isfinite;
      ~~^
/usr/local/include/math.h:749:12: note: 'finite' declared here
extern int finite(double)
           ^
In file included from helloworld.cpp:1:
In file included from /Users/Justin/Library/R/4.0/library/RcppArmadillo/include/RcppArmadillo.h:31:
In file included from /Users/Justin/Library/R/4.0/library/RcppArmadillo/include/RcppArmadilloForward.h:26:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/RcppCommon.h:29:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/Rcpp/r/headers.h:67:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/Rcpp/platform/compiler.h:100:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:317:9: error: no member named 'isinf' in the global namespace
using ::isinf;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:318:9: error: no member named 'isnan' in the global namespace
using ::isnan;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:319:9: error: no member named 'isnormal' in the global namespace
using ::isnormal;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:320:9: error: no member named 'isgreater' in the global namespace
using ::isgreater;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:321:9: error: no member named 'isgreaterequal' in the global namespace
using ::isgreaterequal;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:322:9: error: no member named 'isless' in the global namespace
using ::isless;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:323:9: error: no member named 'islessequal' in the global namespace
using ::islessequal;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:324:9: error: no member named 'islessgreater' in the global namespace
using ::islessgreater;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:325:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:326:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:332:9: error: no member named 'abs' in the global namespace; did you mean 'fabs'?
using ::abs;
      ~~^
/usr/local/include/math.h:417:15: note: 'fabs' declared here
extern double fabs(double);
              ^
In file included from helloworld.cpp:1:
In file included from /Users/Justin/Library/R/4.0/library/RcppArmadillo/include/RcppArmadillo.h:31:
In file included from /Users/Justin/Library/R/4.0/library/RcppArmadillo/include/RcppArmadilloForward.h:26:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/RcppCommon.h:29:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/Rcpp/r/headers.h:67:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/Rcpp/platform/compiler.h:100:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:552:28: error: expected a qualified name after 'typename'
_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
                           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:552:37: error: expected ';' at end of declaration
_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
                                    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:552:37: error: expected unqualified-id
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:564:39: error: use of undeclared identifier 'is_floating_point'
_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
                                      ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:564:57: error: '_A1' does not refer to a value
_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
                                                        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:562:17: note: declared here
template <class _A1>
                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [helloworld.o] Error 1
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include   -I"/Users/Justin/Library/R/4.0/library/Rcpp/include" -I"/Users/Justin/Library/R/4.0/library/RcppArmadillo/include" -I"/Users/Justin/Downloads" -I/usr/local/include   -fPIC  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c helloworld.cpp -o helloworld.o
Error in Rcpp::sourceCpp("Downloads/helloworld.cpp") : 
  Error 1 occurred building shared library.
Rcpp::sourceCpp('Downloads/helloworld.cpp') 在helloworld.cpp中包含的文件中:1: 在/Users/Justin/Library/R/4.0/Library/RcppArmadillo/include/RcppArmadillo.h:31中包含的文件中: 在/Users/Justin/Library/R/4.0/Library/RcppArmadillo/include/RcppArmadilloForward.h:26中包含的文件中: 在/Users/Justin/Library/R/4.0/Library/Rcpp/include/RcppCommon.h:29中包含的文件中: 在/Users/Justin/Library/R/4.0/Library/Rcpp/include/Rcpp/R/headers包含的文件中。h:67: 在/Users/Justin/Library/R/4.0/Library/Rcpp/include/Rcpp/platform/compiler.h:100中包含的文件中: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:314:9:错误:全局命名空间中没有名为“signbit”的成员 使用::signbit; ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:315:9:错误:全局命名空间中没有名为“fpclassify”的成员 使用:fp分类; ~~^ /Applications/Xcode.app/Contents/Developer/toolschains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:316:9:错误:全局命名空间中没有名为“isfinite”的成员;你是说“有限”吗? 使用::isfinite; ~~^ /usr/local/include/math.h:749:12:注意:这里声明了“finite” 外部整数有限(双精度) ^ 在helloworld.cpp中包含的文件中:1: 在/Users/Justin/Library/R/4.0/Library/RcppArmadillo/include/RcppArmadillo.h:31中包含的文件中: 在/Users/Justin/Library/R/4.0/Library/RcppArmadillo/include/RcppArmadilloForward.h:26中包含的文件中: 在/Users/Justin/Library/R/4.0/Library/Rcpp/include/RcppCommon.h:29中包含的文件中: 在/Users/Justin/Library/R/4.0/Library/Rcpp/include/Rcpp/R/headers包含的文件中。h:67: 在/Users/Justin/Library/R/4.0/Library/Rcpp/include/Rcpp/platform/compiler.h:100中包含的文件中: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:317:9:错误:全局命名空间中没有名为“isinf”的成员 使用::isinf; ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:318:9:错误:全局命名空间中没有名为“isnan”的成员 使用::isnan; ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:319:9:错误:全局命名空间中没有名为“isnormal”的成员 使用::是正常的; ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:320:9:错误:全局命名空间中没有名为“ismorer”的成员 使用::isgreat; ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:321:9:错误:全局命名空间中没有名为“isgreaterequal”的成员 使用::isgreaterequal; ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:322:9:错误:全局命名空间中没有名为“isless”的成员 使用::isless; ~~^ /Applications/Xcode.app/Contents/Developer/toolschains/XcodeDefault.xctoolschain/usr/bin/./include/c++/v1/cmath:323:9:错误:全局命名空间中没有名为“islesqual”的成员 使用::islessequal; ~~^ /Applications/Xcode.app/Contents/Developer/toolschains/XcodeDefault.xctoolschain/usr/bin/./include/c++/v1/cmath:324:9:错误:全局命名空间中没有名为“IslessMorger”的成员 使用::islessgreater; ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:325:9:错误:全局命名空间中没有名为“isunordered”的成员 使用::isunordered; ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:326:9:错误:全局命名空间中没有名为“isunordered”的成员 使用::isunordered; ~~^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:332:9:错误:全局命名空间中没有名为“abs”的成员;你是说“晶圆厂”吗? 使用::abs; ~~^ /usr/local/include/math.h:417:15:注意:此处声明了“晶圆厂” 外部双晶圆厂(双); ^ 在helloworld.cpp中包含的文件中:1: 在/Users/Justin/Library/R/4.0/Library/RcppArmadillo/include/RcppArmadillo.h:31中包含的文件中: 在/Users/Justin/Library/R/4.0/Library/RcppArmadillo/include/RcppArmadilloForward.h:26中包含的文件中: 在/Users/Justin/Library/R/4.0/Library/Rcpp/include/RcppCommon.h:29中包含的文件中: 在/Users/Justin/Library/R/4.0/Library/Rcpp/include/Rcpp/R/headers包含的文件中。h:67: 在/Users/Justin/Library/R/4.0/Library/Rcpp/include/Rcpp/platform/compiler.h:100中包含的文件中: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/。/include/c++/v1/cmath:552:28:错误:在“typename”后面应该有一个限定名 _LIBCPP_CONSTEXPR typename启用_if::type ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/./include/c++/v1/cmath:552:37:错误:预期为“;”在申报结束时 _LIBCPP_CONSTEXPR typename启用_if::type ^ /应用程序/Xcode.app/Cont
install.packages(c('Rcpp', 'RcppArmadillo'))
> Rcpp::sourceCpp('Downloads/helloworld.cpp')
In file included from helloworld.cpp:1:
In file included from /Users/Justin/Library/R/4.0/library/RcppArmadillo/include/RcppArmadillo.h:31:
In file included from /Users/Justin/Library/R/4.0/library/RcppArmadillo/include/RcppArmadilloForward.h:26:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/RcppCommon.h:29:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/Rcpp/r/headers.h:67:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/Rcpp/platform/compiler.h:100:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:314:9: error: no member named 'signbit' in the global namespace
using ::signbit;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:315:9: error: no member named 'fpclassify' in the global namespace
using ::fpclassify;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:316:9: error: no member named 'isfinite' in the global namespace; did you mean 'finite'?
using ::isfinite;
      ~~^
/usr/local/include/math.h:749:12: note: 'finite' declared here
extern int finite(double)
           ^
In file included from helloworld.cpp:1:
In file included from /Users/Justin/Library/R/4.0/library/RcppArmadillo/include/RcppArmadillo.h:31:
In file included from /Users/Justin/Library/R/4.0/library/RcppArmadillo/include/RcppArmadilloForward.h:26:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/RcppCommon.h:29:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/Rcpp/r/headers.h:67:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/Rcpp/platform/compiler.h:100:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:317:9: error: no member named 'isinf' in the global namespace
using ::isinf;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:318:9: error: no member named 'isnan' in the global namespace
using ::isnan;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:319:9: error: no member named 'isnormal' in the global namespace
using ::isnormal;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:320:9: error: no member named 'isgreater' in the global namespace
using ::isgreater;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:321:9: error: no member named 'isgreaterequal' in the global namespace
using ::isgreaterequal;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:322:9: error: no member named 'isless' in the global namespace
using ::isless;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:323:9: error: no member named 'islessequal' in the global namespace
using ::islessequal;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:324:9: error: no member named 'islessgreater' in the global namespace
using ::islessgreater;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:325:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:326:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:332:9: error: no member named 'abs' in the global namespace; did you mean 'fabs'?
using ::abs;
      ~~^
/usr/local/include/math.h:417:15: note: 'fabs' declared here
extern double fabs(double);
              ^
In file included from helloworld.cpp:1:
In file included from /Users/Justin/Library/R/4.0/library/RcppArmadillo/include/RcppArmadillo.h:31:
In file included from /Users/Justin/Library/R/4.0/library/RcppArmadillo/include/RcppArmadilloForward.h:26:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/RcppCommon.h:29:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/Rcpp/r/headers.h:67:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/Rcpp/platform/compiler.h:100:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:552:28: error: expected a qualified name after 'typename'
_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
                           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:552:37: error: expected ';' at end of declaration
_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
                                    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:552:37: error: expected unqualified-id
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:564:39: error: use of undeclared identifier 'is_floating_point'
_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
                                      ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:564:57: error: '_A1' does not refer to a value
_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
                                                        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:562:17: note: declared here
template <class _A1>
                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [helloworld.o] Error 1
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include   -I"/Users/Justin/Library/R/4.0/library/Rcpp/include" -I"/Users/Justin/Library/R/4.0/library/RcppArmadillo/include" -I"/Users/Justin/Downloads" -I/usr/local/include   -fPIC  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c helloworld.cpp -o helloworld.o
Error in Rcpp::sourceCpp("Downloads/helloworld.cpp") : 
  Error 1 occurred building shared library.