[Rcpp-devel] Defining template specialisation for wrap on Windows 64bit (Compilation error: 'result_type' does not name a type) [SOLVED]
Renaud Gaujoux
renaud at mancala.cbio.uct.ac.za
Fri Oct 4 14:54:03 CEST 2013
Hi all,
Steve's post got me thinking about a potential more general template
declaration issue, so I browsed around, and came across this post in SO (as
well as a couple of others):
http://stackoverflow.com/questions/14753499/type-defined-in-template-class-does-not-name-a-type
This made me try to just forward declare the 2 Octave classes octave_value
and octave_value_list, and... it worked! (see below)
It does not explain why simply including headers in the order RcppCommon.h
> Octave stuff > Rcpp.h breaks things up, but I'll leave that for next
winter...
So I hear happy voices asking: "do we have RcppOctave for windows now?"
Not yet:
* Compilation is ok
* Linking is ok, after I managed to solve issues which were going silent
on Linux due to some "magic" resolution of dependencies to libraries.
Libraries liboctave and libcruft are apparently needed but were not stated
in the gcc command, which worked fine in Linux. Plus Octave windows GCC
dlls are suffixed .dll.a and not just .dll
Problem: loading Octave windows libraries from R crashes Rterm. It
complains about the .dll.a objects not being "either not designed to run on
Windows or contains errors...". This is my next quest. Anybody has an idea
on this?
Thank you all who helped solved the original issue!
Bests,
Renaud, taking impulsion for the cross-platform leap
#####
My header now looks like this:
// rcpp_octave.h
#include <RcppCommon.h>
// forward declaration of Octave classes
class octave_value;
class octave_value_list;
// declaring the specialization
namespace Rcpp {
template <> SEXP wrap( const octave_value& );
template <> SEXP wrap( const octave_value_list& );
template <> octave_value as( SEXP );
template <> octave_value_list as( SEXP );
}
// this must appear after the specialization,
// otherwise the specialization will not be seen by Rcpp types
#include <Rcpp.h>
// Octave libraries
#include <octave/config.h>
#include <octave/oct-obj.h>
// .....
/////////
Compilation now only warns about macro _WIN32_WINNT being redefined, which
I can easily live with:
g++ -m32 -I"c:/R/R-3.0.2/include" -DNDEBUG
-IC:/R/R-3.0.2/library/Rcpp/include -fmax-errors=10 -DOCT_POST_3_4_0=1
-I"C:\Octave\Octave3.6.4_g
cc4.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\octav
e/../" -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
In file included from rcpp_octave.h:36:0,
from rcpp_octave.cpp:21:
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]
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20131004/e3acc20f/attachment.html>
More information about the Rcpp-devel
mailing list