在R中安装sourcetools失败

时间:2016-03-31 20:23:53

标签: r shiny

我在R中安装sourcetools时遇到问题,这是安装闪亮的依赖项之一。

R版本为3.4.0。

你可以从以下方面做出正面和反面:

install.packages('sourcetools', repos='http://cran.us.r-project.org')
trying URL 'http://cran.us.r-project.org/src/contrib/sourcetools_0.1.2.tar.gz'
Content type 'application/x-gzip' length 16227 bytes (15 KB)
==================================================
downloaded 15 KB

* installing *source* package 'sourcetools' ...
** package 'sourcetools' successfully unpacked and MD5 sums checked
** libs
g++ -std=c++0x -I/home/tomgeo/R/lib64/R/include -DNDEBUG -I../inst/include -I/usr/local/include    -fpic  -g -O2 -c Reader.cpp -o Reader.o
g++ -std=c++0x -I/home/tomgeo/R/lib64/R/include -DNDEBUG -I../inst/include -I/usr/local/include    -fpic  -g -O2 -c Tokenizer.cpp -o Tokenizer.o
In file included from ../inst/include/sourcetools/cursor/TokenCursor.h:7,
             from ../inst/include/sourcetools/cursor/cursor.h:5,
             from ../inst/include/sourcetools.h:11,
             from Tokenizer.cpp:1:
../inst/include/sourcetools/tokenization/Token.h: In constructor 'sourcetools::tokens::Token::Token()':
../inst/include/sourcetools/tokenization/Token.h:27: error: 'nullptr' was not declared in this scope
../inst/include/sourcetools/tokenization/Token.h: In constructor 'sourcetools::tokens::Token::Token(sourcetools::tokens::TokenType)':
../inst/include/sourcetools/tokenization/Token.h:34: error: 'nullptr' was not declared in this scope
../inst/include/sourcetools/tokenization/Token.h: In constructor 'sourcetools::tokens::Token::Token(const sourcetools::tokens::Token::Position&)':
../inst/include/sourcetools/tokenization/Token.h:41: error: 'nullptr' was not declared in this scope
../inst/include/sourcetools/tokenization/Token.h: In function 'std::ostream& sourcetools::operator<<(std::ostream&, const std::vector<sourcetools::tokens::Token, std::allocator<sourcetools::tokens::Token> >&)':
../inst/include/sourcetools/tokenization/Token.h:457: error: expected initializer before ':' token
../inst/include/sourcetools/tokenization/Token.h:459: error: expected primary-expression before 'return'
../inst/include/sourcetools/tokenization/Token.h:459: error: expected ';' before 'return'
../inst/include/sourcetools/tokenization/Token.h:459: error: expected primary-expression before 'return'
../inst/include/sourcetools/tokenization/Token.h:459: error: expected ')' before 'return'
In file included from ../inst/include/sourcetools/cursor/cursor.h:5,
             from ../inst/include/sourcetools.h:11,
             from Tokenizer.cpp:1:
../inst/include/sourcetools/cursor/TokenCursor.h: In member function 'bool sourcetools::cursors::TokenCursor::moveToPosition(const sourcetools::cursors::TokenCursor::Position&)':
../inst/include/sourcetools/cursor/TokenCursor.h:167: error: expected primary-expression before '[' token
../inst/include/sourcetools/cursor/TokenCursor.h:167: error: expected primary-expression before ']' token
../inst/include/sourcetools/cursor/TokenCursor.h:167: error: expected primary-expression before 'const'
../inst/include/sourcetools/cursor/TokenCursor.h:167: error: expected primary-expression before 'const'
make: *** [Tokenizer.o] Error 1
ERROR: compilation failed for package 'sourcetools'

1 个答案:

答案 0 :(得分:1)

CRAN上的sourcetools版本需要具有C ++ 11功能的编译器。开发版本解除了这一限制,并试图遵循C ++ 98标准,以便它可以在较旧的编译器上构建。

您应该可以使用例如

安装sourcetools的开发版本
devtools::install_github("kevinushey/sourcetools")

如果您仍然遇到问题,请随时在GitHub repository上提出问题。