[Rcpp-devel] Defining template specialisation for wrap on Windows 64bit (Compilation error: 'result_type' does not name a type)

Dirk Eddelbuettel edd at debian.org
Tue Oct 1 17:37:02 CEST 2013


On 1 October 2013 at 17:20, Renaud Gaujoux wrote:
| I wanted to "quickly" port my package RcppOctave to run on Windows

Yay! Three cheers!

| but it turned out trickier than expected :(

Boo indeed.
 
| I am getting compilation errors (8750 lines of errors - see first line below).
| The code defines a specialisation for wrap, following the
| non-intrusive way described in the vignette. Everything has always
| worked smoothly on Linux (Ubuntu 13.10). On Windows there seems to be
| some kind of conflict which messes up with type definitions, and this
| happens as soon as I include Rcpp.h.

Ex-ante, that shouldn't happen, and rarely happens with Rcpp* code. There
generally is little platform specific code at the 'Rcpp user' package level.

So maybe, just maybe this comes from the Octave headers?  Could you possibly
separate this out and test the wrapping aspect on a mocked-up simple C++ class?

| I noticed the "redefined" warnings before the error, but I am not sure
| how this can break compilation that much.

There is a lot of line noise. Setting the 'nodosfilewarning' env var helps
with that. 
 
| Does anybody have a hint on this puzzling issue?

I'd simplify first. Try smaller example on Windows not involving Octave
headers. 

Dirk

| Thank you.
| 
| Bests,
| Renaud
| 
| Minimal C++ code that produces the error:
| 
| //rcpp_octave.h
| 
| #ifndef _RcppOctave_RCPP_OCTAVE_H
| #define _RcppOctave_RCPP_OCTAVE_H
| 
| #include <RcppCommon.h>
| 
| // Octave libraries
| #include <octave/oct.h>
| 
| // declaring the specialization
| namespace Rcpp {
|     template <> SEXP wrap( const octave_value& );
| }
| 
| // this must appear after the specialization,
| // otherwise the specialization will not be seen by Rcpp types
| #include <Rcpp.h>
| #endif
| 
| ####
| 
| //rcpp_octave.cpp
| 
| #include "rcpp_octave.h"
| 
| void dummy(){
| 
| }
| 
| 
| ### COMPILATION LOG ###
| 
|    [1] "* installing *source* package 'RcppOctave' ..."
|    [2] "cygwin warning:"
|    [3] "  MS-DOS style path detected: C:/R/R-30~1.2/bin/x64/R"
|    [4] "  Preferred POSIX equivalent is:
| /cygdrive/c/R/R-30~1.2/bin/x64/R"
|    [5] "  CYGWIN environment variable option \"nodosfilewarning\"
| turns off this warning."
|    [6] "  Consult the user's guide for more details about POSIX
| paths:"
|    [7] "    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames"
|    [8] "-lR: not found"
|    [9] "Checking whether R is a shared library... YES"
|   [10] "Using R LDFLAGS: -LC:/R/R-30~1.2/bin/x64 -lR"
|   [11] "Using R CPPFLAGS: -IC:/R/R-30~1.2/include
| -IC:/R/R-30~1.2/include/x64"
|   [12] "Checking Octave include directory... "
|   [13] "    C:\\Octave\\Octave3.6.4_gcc4.6.2\\include\\octave-3.6.4\\octave"
|   [14] "    C:\\Octave\\Octave3.6.4_gcc4.6.2\\include"
|   [15] "Checking Octave library directory...
| C:\\Octave\\Octave3.6.4_gcc4.6.2\\lib\\octave\\3.6.4"
|   [16] "Checking Octave version... 3.6.4"
|   [17] "Checking whether to infer output names for Octave function (>=
| 3.4.3)... YES"
|   [18] "RcppOctave Octave module directory...
| z:/projects/RcppOctave/libwin/RcppOctave/modules"
|   [19] "** libs"
|   [20] "Warning: this package has a non-empty 'configure.win' file,"
|   [21] "so building only the main architecture"
|   [22] ""
|   [23] "cygwin warning:"
|   [24] "  MS-DOS style path detected: C:/R/R-30~1.2/etc/x64/Makeconf"
|   [25] "  Preferred POSIX equivalent is:
| /cygdrive/c/R/R-30~1.2/etc/x64/Makeconf"
|   [26] "  CYGWIN environment variable option \"nodosfilewarning\"
| turns off this warning."
|   [27] "  Consult the user's guide for more details about POSIX
| paths:"
|   [28] "    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames"
|   [29] "g++ -m64 -I\"C:/R/R-30~1.2/include\" -DNDEBUG
| -IC:/R/R-3.0.2/library/Rcpp/include -DOCT_POST_3_4_0=1
| -I\"C:\\Octave\\Octave3.6.4_gcc4.6.2\\include\"
| -I\"C:\\Octave\\Octave3.6.4_gcc4.6.2\\include\\octave-3.6.4\\octave\"
| -I\"C:\\Octave\\Octave3.6.4_gcc4.6.2\\include\\octave-3.6.4\\octave/../\"
|   -I\"C:/R/R-3.0.2/library/Rcpp/include\"
| -I\"d:/RCompile/CRANpkg/extralibs64/local/include\"     -O2 -Wall
| -mtune=core2 -c rcpp_octave.cpp -o rcpp_octave.o"
|   [30] "In file included from
| C:\\Octave\\Octave3.6.4_gcc4.6.2\\include\\octave-3.6.4\\octave/../octave/oct.h:31:0,"
|   [31] "                 from rcpp_octave.h:10,"
|   [32] "                 from rcpp_octave.cpp:21:"
|   [33] "C:\\Octave\\Octave3.6.4_gcc4.6.2\\include\\octave-3.6.4\\octave/../octave/config.h:2764:0:
| warning: \"_WIN32_WINNT\" redefined [enabled by default]"
|   [34] "c:\\rtools\\gcc-4.6.3\\bin\\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/include/_mingw.h:244:0:
| note: this is the location of the previous definition"
|   [35] "In file included from
| C:/R/R-3.0.2/library/Rcpp/include/Rcpp.h:50:0,"
|   [36] "                 from rcpp_octave.h:25,"
|   [37] "                 from rcpp_octave.cpp:21:"
|   [38] "C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h:156:21:
| error: 'result_type' does not name a type"
|   [39] "C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h:161:24:
| error: ISO C++ forbids declaration of 'operator()' with no type
| [-fpermissive]"
|   [40] "C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h: In member
| function 'int Rcpp::fixed_call< <template-parameter-1-1>
| >::operator()()':"
|   [41] "C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h:162:41:
| error: no matching function for call to 'as(SEXPREC*&)'"
|   [42] "C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h:162:41:
| note: candidate is:"
|   [43] "C:/R/R-3.0.2/library/Rcpp/include/Rcpp/as.h:144:29: note:
| template<class T> T Rcpp::as(SEXP)"
|   [44] "C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h: At global
| scope:"
|   [45] "C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h:170:56:
| error: template argument 2 is invalid"
|   [46] "C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h:176:41:
| error: ISO C++ forbids declaration of 'operator()' with no type
| [-fpermissive]"
|   [47] "C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h: In member
| function 'int Rcpp::unary_call<T, <template-parameter-1-2>
| >::operator()(const T&)':"
|   [48] "C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h:178:41:
| error: no matching function for call to 'as(SEXPREC*&)'"
|   [49] "C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h:178:41:
| note: candidate is:"
|   [50] "C:/R/R-3.0.2/library/Rcpp/include/Rcpp/as.h:144:29: note:
| template<class T> T Rcpp::as(SEXP)"
|   [51] "C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h: At global
| scope:"
|   [52] "C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h:187:62:
| error: template argument 3 is invalid"
|   [53] "C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h:193:52:
| error: ISO C++ forbids declaration of 'operator()' with no type
| [-fpermissive]"
|   [54] "C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h: In member
| function 'int Rcpp::binary_call<T1, T2, <template-parameter-1-3>
| >::operator()(const T1&, const T2&)':"
|   [55] "C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h:196:41:
| error: no matching function for call to 'as(SEXPREC*&)'"
|   [56] "C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h:196:41:
| note: candidate is:"
|   [57] "C:/R/R-3.0.2/library/Rcpp/include/Rcpp/as.h:144:29: note:
| template<class T> T Rcpp::as(SEXP)"
|   [58] "In file included from
| C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Module.h:85:0,"
|   [59] "                 from
| C:/R/R-3.0.2/library/Rcpp/include/Rcpp.h:63,"
|   [60] "                 from rcpp_octave.h:25,"
|   [61] "                 from rcpp_octave.cpp:21:"
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list