c++ - Rcpp: error occured building shared library -
i have cpp code in file named psm.cpp given below,
#include <rcpp.h> // [[rcpp::export]] std::vector<std::string> useinitlists() { std::vector<std::string> vec = {"larry", "curly", "moe"}; return vec; }
when source following code, following error.
> rcpp::sourcecpp("psm.cpp") g++ -m64 -i"c:/progra~1/r/r-30~1.2/include" -dndebug -i"c:/users/30708/documents/r/win-library/3.0/rcpp/include" -i"d:/rcompile/cranpkg/extralibs64/local/include" -o2 -wall -mtune=core2 -c psm.cpp -o psm.o psm.cpp: in function 'std::vector<std::basic_string<char> > useinitlists()': psm.cpp:5:60: error: in c++98 'vec' must initialized constructor, not '{...}' psm.cpp:5:60: error: not convert '{"larry", "curly", "moe"}' '<brace-enclosed initializer list>' 'std::vector<std::basic_string<char> >' make: *** [psm.o] error 1 error in rcpp::sourcecpp("psm.cpp") : error 1 occurred building shared library.
can please suggest error means , how resolve same? thanks.
you can use alternative -std=c++0x
, never used g++ on windows.
(glad helped !)
Comments
Post a Comment