<div dir="ltr"><div>Thanks for popping in Steve. I was full of hope when I read your reply!<br>Unfortunately I could not solve the issue with the changes you suggested.<br><br><br>> I believe the correct syntax for the specialization is<br>
><br>> template <> octave_value as<octave_value>( SEXP );<br>><br><br>This declaration works as fine on Linux as the one omitting "<octave_value>". No luck on Windows though (but see below)<br>
<br>> but one cannot write:<br>> SEXP sx;<br>> octave_value ov = as(sx); // type deduction applies only to arguments, not return value!<br>><br>> // correct:<br>> // ov = as<octave_value>(sx);<br><br>
yes, this makes completely sense, and this is how I indeed call the template function.<br><br>I reduced the code even more and actually get the same errors even without declaring any template specialisation, but just including <Rcpp.h>! See code below. <br>
I don't see why only including the headers in sequence breaks compilation, since we are not even defining .<br>The first reported error occurs in include/Rcpp/Language.h, in the following class, where 'result_type' is defined by typdef:<br>
<br> template <typename OUT=SEXP><br> class fixed_call {<br> public:<br> <b>typedef OUT result_type ;</b><br> <br> fixed_call( Language call_ ) : call(call_){}<br> fixed_call( Function fun ) : call(fun){}<br>
<br> OUT operator()(){<br> return as<OUT>( call.eval() ) ;<br> }<br> <br> private:<br> Language call ;<br> } ;<span class=""></span><span class=""></span><br><br><br>
</div><div>This got me thinking and googling for this more general error (see next email). Yeah!!<br><br></div><div>Renaud<br></div><div><br><br>##############<br>// Single file rcpp_octave.cpp<br><br>// RcppCommon<br>#include <RcppCommon.h><br>
// Octave libraries<br>#include <octave/config.h><br>#include <octave/ov.h><br>// Rcpp<br>#include <Rcpp.h><br><br><br>void dummy(){<br><br>}<br><br>###<br>Compilation log (I managed to force gcc to stop after 10 errors: I learnt something today):<br>
<br>** libs<br>Warning: this package has a non-empty 'configure.win' file,<br>so building only the main architecture<br><br>g++ -m32 -I"c:/R/R-3.0.2/include" -DNDEBUG -IC:/R/R-3.0.2/library/Rcpp/include -fmax-errors=10 -Wall -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<br>
<br>In file included from rcpp_octave.cpp:24:0:<br>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]<br>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 In file included from C:/R/R-3.0.2/library/Rcpp/include/Rcpp.h:50:0,<br>
from rcpp_octave.cpp:27:<br>C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h:156:21: error: 'result_type' does not name a type<br>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]<br>
C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h: In member function 'int Rcpp::fixed_call< <template-parameter-1-1> >::operator()()':<br>C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h:162:41: error: no matching function for call to 'as(SEXPREC*&)'<br>
C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h:162:41: note: candidate is:<br>C:/R/R-3.0.2/library/Rcpp/include/Rcpp/as.h:144:29: note: template<class T> T Rcpp::as(SEXP)<br>C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h: At global scope:<br>
C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h:170:56: error: template argument 2 is invalid<br>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]<br>
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<br>T&)':<br>C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h:178:41: error: no matching function for call to 'as(SEXPREC*&)'<br>
C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h:178:41: note: candidate is:<br>C:/R/R-3.0.2/library/Rcpp/include/Rcpp/as.h:144:29: note: template<class T> T Rcpp::as(SEXP)<br>C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h: At global scope:<br>
C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h:187:62: error: template argument 3 is invalid<br>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]<br>
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()(<br>const T1&, const T2&)':<br>C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h:196:41: error: no matching function for call to 'as(SEXPREC*&)'<br>
C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Language.h:196:41: note: candidate is:<br>C:/R/R-3.0.2/library/Rcpp/include/Rcpp/as.h:144:29: note: template<class T> T Rcpp::as(SEXP)<br>In file included from C:/R/R-3.0.2/library/Rcpp/include/Rcpp/Module.h:85:0,<br>
from C:/R/R-3.0.2/library/Rcpp/include/Rcpp.h:63,<br> from rcpp_octave.cpp:27:<br>C:/R/R-3.0.2/library/Rcpp/include/Rcpp/module/Module_generated_get_return_type.h: In function 'std::string Rcpp::get_return_type_dispatch(Rc<br>
pp::traits::false_type)':<br>C:/R/R-3.0.2/library/Rcpp/include/Rcpp/module/Module_generated_get_return_type.h:29:32: error: expected primary-expression before ')' token<br>compilation terminated due to -fmax-errors=10.<br>
make: *** [rcpp_octave.o] Error 1<br>ERROR: compilation failed for package 'RcppOctave'<br>* removing 'Z:/projects/RcppOctave/libwin/RcppOctave'<br>* restoring previous 'Z:/projects/RcppOctave/libwin/RcppOctave'<br>
</div></div>