Rcpp11 / attributes

Standalone implementation of Rcpp attributes.
Other
3 stars 1 forks source link

Error with sourceCpp() #37

Closed stanthil closed 9 years ago

stanthil commented 9 years ago

Hi,

I am looking to use Rcpp11 but running the following lines :

library(Rcpp11)
library(attributes)
sourceCpp('test.cpp', verbose=TRUE)

returns this error :

#include <Rcpp11>

// [[export]]
IntegerVector foo(){  
  return {1, 2, 3} ;
}

// foo (test.cpp:4) - Rcpp::export
extern "C" SEXP sourceCpp_foo(  ){

  BEGIN_RCPP
    SEXP __sexp_result ;
    {
      Rcpp::RNGScope __rngScope;

      IntegerVector __result = foo() ; PROTECT(__sexp_result = Rcpp::wrap(__result)) ;
    }
    UNPROTECT(1) ;
    return __sexp_result ;
  END_RCPP

}
C:/PROGRA~1/R/R-31~1.2/bin/i386/R CMD SHLIB "filecbc71491c83.cpp"
Warning message:
running command 'make -f "C:/PROGRA~1/R/R-31~1.2/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-31~1.2/share/make/winshlib.mk" CXX='$(CXX1X) $(CXX1XSTD)' CXXFLAGS='$(CXX1XFLAGS)' CXXPICFLAGS='$(CXX1XPICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX1XLDFLAGS)' SHLIB_LD='$(SHLIB_CXX1XLD)' SHLIB="filecbc71491c83.dll" OBJECTS="filecbc71491c83.o"' had status 127 
Error in inDL(x, as.logical(local), as.logical(now), ...) : 
  unable to load shared object 'C:/Users/ADMINI~1/AppData/Local/Temp/RtmpqqZQZJ/filecbc71491c83.dll':
  LoadLibrary failure:  Le module spécifié est introuvable.
In addition: Warning message:
running command 'C:/PROGRA~1/R/R-31~1.2/bin/i386/R CMD SHLIB "filecbc71491c83.cpp"' had status 1 

What might be the problem here ?

Session info :

R version 3.1.2 (2014-10-31)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252    LC_MONETARY=French_France.1252 LC_NUMERIC=C                  
[5] LC_TIME=French_France.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] attributes_0.0   Rcpp11_3.1.2.0.1

loaded via a namespace (and not attached):
[1] tools_3.1.2
romainfrancois commented 9 years ago

attributes::sourceCpp should have given you more text. I get a lot of it mainly related to the fact that the compiler in Rtools 31 does not support C++11 fully.

> attributes::sourceCpp( "foo.cpp", verbose = TRUE )
#include <Rcpp11>
using namespace Rcpp11;

// [[Rcpp::export]]
IntegerVector foo() {
   return {1,2,3};
}

// foo (foo.cpp:4) - Rcpp::export
extern "C" SEXP sourceCpp_foo(  ){

  BEGIN_RCPP
    SEXP __sexp_result ;
    {
      Rcpp::RNGScope __rngScope;

      IntegerVector __result = foo() ; PROTECT(__sexp_result = Rcpp::wrap(__result)) ;
    }
    UNPROTECT(1) ;
    return __sexp_result ;
  END_RCPP

}
C:/R/R-31~1.2/bin/x64/R CMD SHLIB "file6342fb07807.cpp"
cygwin warning:
  MS-DOS style path detected: C:/R/R-31~1.2/etc/x64/Makeconf
  Preferred POSIX equivalent is: /cygdrive/c/R/R-31~1.2/etc/x64/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++ -m64 -std=c++0x -I"C:/R/R-31~1.2/include" -DNDEBUG     -I"C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include" -I"d:/RCompile/CRANpkg/extralibs64/local/include"     -O2 -Wall  -mtune=core2 -c file6342fb07807.cpp -o file6342fb07807.o
In file included from C:/R/R-31~1.2/include/R.h:50:0,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/R.h:18,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp.h:30,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp11:4,
                 from file6342fb07807.cpp:1:
C:/R/R-31~1.2/include/R_ext/RS.h:45:0: warning: "ERROR" redefined [enabled by default]
c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/include/wingdi.h:70:0: note: this is the location of the previous definition
In file included from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp.h:29:0,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp11:4,
                 from file6342fb07807.cpp:1:
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/internal/library.h: In member function 'void* Rcpp::internal::Library::operator[](const string&)':
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/internal/library.h:69:20: error: '__SYMBOL' was not declared in this scope
In file included from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/parallel.h:4:0,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp.h:76,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp11:4,
                 from file6342fb07807.cpp:1:
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/copy.h: In function 'void Rcpp::parallel::copy_impl(InputIterator, InputIterator, OutputIterator, std::random_access_iterator_tag)':
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/copy.h:15:28: error: 'std::thread' has not been declared
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/copy.h:17:29: error: 'thread' is not a member of 'std'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/copy.h:17:29: error: 'thread' is not a member of 'std'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/copy.h:17:40: error: template argument 1 is invalid
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/copy.h:17:40: error: template argument 2 is invalid
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/copy.h:17:49: error: invalid type in declaration before '(' token
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/copy.h:21:30: error: invalid types 'int[int]' for array subscript
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/copy.h:21:34: error: 'thread' is not a member of 'std'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/copy.h:26:59: error: invalid types 'int[int]' for array subscript
In file included from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/parallel.h:5:0,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp.h:76,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp11:4,
                 from file6342fb07807.cpp:1:
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/transform.h: In function 'void Rcpp::parallel::transform_impl(InputIterator, InputIterator, OutputIterator, Function, std::random_access_iterator_tag)':
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/transform.h:9:28: error: 'std::thread' has not been declared
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/transform.h:12:29: error: 'thread' is not a member of 'std'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/transform.h:12:29: error: 'thread' is not a member of 'std'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/transform.h:12:40: error: template argument 1 is invalid
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/transform.h:12:40: error: template argument 2 is invalid
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/transform.h:12:49: error: invalid type in declaration before '(' token
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/transform.h:16:30: error: invalid types 'int[int]' for array subscript
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/transform.h:16:34: error: 'thread' is not a member of 'std'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/transform.h:22:59: error: invalid types 'int[int]' for array subscript
In file included from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/parallel.h:6:0,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp.h:76,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp11:4,
                 from file6342fb07807.cpp:1:
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/iota.h: In function 'void Rcpp::parallel::iota(OutputIterator, OutputIterator, T)':
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/iota.h:10:28: error: 'std::thread' has not been declared
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/iota.h:12:29: error: 'thread' is not a member of 'std'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/iota.h:12:29: error: 'thread' is not a member of 'std'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/iota.h:12:40: error: template argument 1 is invalid
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/iota.h:12:40: error: template argument 2 is invalid
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/iota.h:12:49: error: invalid type in declaration before '(' token
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/iota.h:16:30: error: invalid types 'int[int]' for array subscript
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/iota.h:16:34: error: 'thread' is not a member of 'std'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/iota.h:21:59: error: invalid types 'int[int]' for array subscript
In file included from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/parallel.h:7:0,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp.h:76,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp11:4,
                 from file6342fb07807.cpp:1:
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/generate_n.h: In function 'void Rcpp::parallel::generate_n(OutputIterator, Size, Generator)':
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/generate_n.h:9:28: error: 'std::thread' has not been declared
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/generate_n.h:11:29: error: 'thread' is not a member of 'std'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/generate_n.h:11:29: error: 'thread' is not a member of 'std'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/generate_n.h:11:40: error: template argument 1 is invalid
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/generate_n.h:11:40: error: template argument 2 is invalid
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/generate_n.h:11:49: error: invalid type in declaration before '(' token
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/generate_n.h:15:30: error: invalid types 'int[int]' for array subscript
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/generate_n.h:15:34: error: 'thread' is not a member of 'std'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/utils/parallel/generate_n.h:19:59: error: invalid types 'int[int]' for array subscript
In file included from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/registration/registration.h:4:0,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp.h:179,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp11:4,
                 from file6342fb07807.cpp:1:
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/registration/DotCall.h: At global scope:
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/registration/DotCall.h:8:37: error: expected identifier before '(' token
In file included from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/registration/registration.h:5:0,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp.h:179,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp11:4,
                 from file6342fb07807.cpp:1:
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/registration/DotExternal.h:8:41: error: expected identifier before '(' token
In file included from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/Vector.h:25:0,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp.h:204,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp11:4,
                 from file6342fb07807.cpp:1:
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/String.h: In constructor 'Rcpp::String::String(std::string)':
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/String.h:37:34: error: type 'Rcpp::String' is not a direct base of 'Rcpp::String'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/String.h: In constructor 'Rcpp::String::String(const wstring&)':
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/String.h:40:42: error: type 'Rcpp::String' is not a direct base of 'Rcpp::String'
In file included from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp.h:211:0,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp11:4,
                 from file6342fb07807.cpp:1:
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/Language.h: At global scope:
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/Language.h:83:47: error: ISO C++ forbids declaration of 'operator()' with no type [-fpermissive]
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/Language.h: In member function 'int Rcpp::typed_call< <template-parameter-1-1>, Args>::operator()(Args&& ...)':
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/Language.h:85:41: error: no matching function for call to 'as(SEXPREC*&)'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/Language.h:85:41: note: candidate is:
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp.h:155:29: note: template<class T> T Rcpp::as(SEXP)
In file included from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp.h:218:0,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp11:4,
                 from file6342fb07807.cpp:1:
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/Array.h: At global scope:
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/Array.h:60:58: error: expected unqualified-id before 'using'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/Array.h:61:58: error: expected unqualified-id before 'using'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/Array.h:62:58: error: expected unqualified-id before 'using'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/Array.h:63:58: error: expected unqualified-id before 'using'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/Array.h:64:58: error: expected unqualified-id before 'using'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/Array.h:65:58: error: expected unqualified-id before 'using'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/Array.h:66:58: error: expected unqualified-id before 'using'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/Array.h:67:58: error: expected unqualified-id before 'using'
In file included from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/lazy.h:5:0,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/sugar.h:8,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp.h:228,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp11:4,
                 from file6342fb07807.cpp:1:
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h:9:15: error: expected nested-name-specifier before 'Tuple'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h:9:15: error: using-declaration for non-member at class scope
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h:9:21: error: expected ';' before '=' token
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h:9:21: error: expected unqualified-id before '=' token
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h:11:37: error: 'Tuple' does not name a type
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h:11:44: error: ISO C++ forbids declaration of 'data_' with no type [-fpermissive]
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h:27:15: error: 'Tuple' does not name a type
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h: In constructor 'Rcpp::TupleWrapper_NoNames<Args>::TupleWrapper_NoNames(const int&)':
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h:11:54: error: class 'Rcpp::TupleWrapper_NoNames<Args>' does not have any field named 'data'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h: In member function 'void Rcpp::TupleWrapper_NoNames<Args>::set_value(Iterator&, std::true_type) const':
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h:31:41: error: 'data' was not declared in this scope
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h: At global scope:
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h:45:15: error: expected nested-name-specifier before 'Tuple'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h:45:15: error: using-declaration for non-member at class scope
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h:45:21: error: expected ';' before '=' token
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h:45:21: error: expected unqualified-id before '=' token
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h:48:43: error: 'Tuple' does not name a type
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h:48:50: error: ISO C++ forbids declaration of 'data_' with no type [-fpermissive]
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h:82:13: error: 'Tuple' does not name a type
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h: In constructor 'Rcpp::TupleWrapper_WithNames<Args>::TupleWrapper_WithNames(const int&)':
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h:48:60: error: class 'Rcpp::TupleWrapper_WithNames<Args>' does not have any field named 'data'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h: In member function 'void Rcpp::TupleWrapper_WithNames<Args>::set_value(Rcpp::Shield<SEXPREC*>&, Iterator&, std::true_type) const':
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h:70:44: error: 'data' was not declared in this scope
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h: At global scope:
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h:88:15: error: expected nested-name-specifier before 'type'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h:88:15: error: using-declaration for non-member at class scope
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h:88:20: error: expected ';' before '=' token
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/sugar/lazy/TupleWrapper.h:88:20: error: expected unqualified-id before '=' token
In file included from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/stats/stats.h:4:0,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp.h:229,
                 from C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp11:4,
                 from file6342fb07807.cpp:1:
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/stats/dpq.h:38:1: error: expected initializer before 'long'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/stats/dpq.h:38:1: error: expected initializer before 'long'
C:/Users/romain/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/stats/dpq.h:38:1: error: expected initializer before 'long'
make: *** [file6342fb07807.o] Error 1
Message d'avis :
l'exécution de la commande 'make -f "C:/R/R-31~1.2/etc/x64/Makeconf" -f "C:/R/R-31~1.2/share/make/winshlib.mk" CXX='$(CXX1X) $(CXX1XSTD)' CXXFLAGS='$(CXX1XFLAGS)' CXXPICFLAGS='$(CXX1XPICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX1XLDFLAGS)' SHLIB_LD='$(SHLIB_CXX1XLD)' SHLIB="file6342fb07807.dll" WIN=64 TCLBIN=64 OBJECTS="file6342fb07807.o"' renvoie un statut 2 
Error in inDL(x, as.logical(local), as.logical(now), ...) : 
  unable to load shared object 'C:/Users/romain/AppData/Local/Temp/RtmpY7Kxo8/file6342fb07807.dll':
  LoadLibrary failure:  Le module spécifié est introuvable.
In addition: Warning message:
running command 'C:/R/R-31~1.2/bin/x64/R CMD SHLIB "file6342fb07807.cpp"' had status 1

Not much we can do at this point besides waiting for the toolchain that had been subtly announced to be released with R 3.2.0 in next spring.

romainfrancois commented 9 years ago

e.g.

 error: 'Tuple' does not name a type

is because C++0x does not support the using notation. A lot of error are related to that. Nothing I can really do, as part of Rcpp11 3.1.2.0 we do mean C++11 for real, not pseudo unfinished c++0x

eddelbuettel commented 9 years ago

I noticed this earlier today and did a quick test with Rcpp -- it works on Windows with the old g++.

But as we do not have the new IntegerVector constructor, you need one more step. So here is a slightly expanded example.

#include <Rcpp.h>

// Enable C++11 -- or rather C++0x which is all Windows has
// [[Rcpp::plugins("cpp0x")]]

// [[Rcpp::export]]
Rcpp::IntegerVector foo() {  
  std::vector<int> x = {1, 2, 3};
  return Rcpp::IntegerVector(Rcpp::wrap(x));
}

// [[Rcpp::export]]
std::vector<int> bar() {  
  std::vector<int> x = {1, 2, 3};
  return x;
}

/*** R
foo()
bar()
*/

which works out fine under Windows:

R> library(Rcpp)
R> sourceCpp("C:/TEMP/ghtbStan.cpp")

R> foo()
[1] 1 2 3

R> bar()
[1] 1 2 3
R>

on a system with

R> Sys.info()
                     sysname                      release                      version 
                   "Windows"                      "7 x64" "build 7601, Service Pack 1" 
                    nodename                      machine                        login 
                "DIRK3500W7"                     "x86-64"              "deddelbuettel" 
                        user               effective_user 
             "deddelbuettel"              "deddelbuettel" 
R> 
romainfrancois commented 9 years ago

So @eddelbuettel what does this have to do with attributes or Rcpp11 ?

Also your foo and bar are a waste of memory as they imply a deep copy of everything, in wrap for foo and implicitly as returned by bar.

The fact that Rcpp11 only works with C++11 is by design. a feature.

Although I prefer the elegant code as used by @gthbStan, I can also use your less elegant code with Rcpp11, given a real c++11 compiler is used, not some vague c++0x intermediate version. c++0x is not a standard, c++11 is.

$ Rcpp11Script /tmp/dirk.cpp

> foo()
[1] 1 2 3

> bar()
[1] 1 2 3
Message d'avis :
In sourceCpp(tail(args, 1), verbose = "-v" %in% args) :
  unknown attribute 'Rcpp::plugins'
eddelbuettel commented 9 years ago

I saw the request for help by a user, and had a quick check to see what Rcpp could do.

And after you offered "please wait until April 2015 for R 3.2.0" I considered it to helpful to show what works today -- and what as a matter of fact has worked for years.

romainfrancois commented 9 years ago

How generous of you.

stanthil commented 9 years ago

Thanks @romainfrancois and @eddelbuettel for your valuable answers.