[Rcpp-devel] Defining template specialisation for wrap on Windows 64bit (Compilation error: 'result_type' does not name a type) [SOLVED]
Steve Jaffe
sjaffe at riskspan.com
Fri Oct 4 17:37:31 CEST 2013
It's probably not related, but it's possible that there's connection between
"It complains about the .dll.a objects not being "either not designed to run on
Windows or contains errors...".
and
"Compilation now only warns about macro _WIN32_WINNT being redefined...".
Anyway would be nice to resolve that warning and definitely rule it out.
Steve
------------------------------
Message: 2
Date: Fri, 4 Oct 2013 14:54:03 +0200
From: Renaud Gaujoux <renaud at mancala.cbio.uct.ac.za>
To: "rcpp-devel at lists.r-forge.r-project.org"
<rcpp-devel at lists.r-forge.r-project.org>
Subject: Re: [Rcpp-devel] Defining template specialisation for wrap on
Windows 64bit (Compilation error: 'result_type' does not name a type)
[SOLVED]
Message-ID:
<CAHavPHHvO9cGm+cJ-MOVc-FJeFJtjpDbGB=r49zMdvpfzSfJrg at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
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-0001.html>
------------------------------
Message: 3
Date: Fri, 4 Oct 2013 10:30:36 -0500
From: Steve Jaffe <sjaffe at riskspan.com>
To: "rcpp-devel at lists.r-forge.r-project.org"
<rcpp-devel at lists.r-forge.r-project.org>
Cc: Renaud Gaujoux <renaud at mancala.cbio.uct.ac.za>
Subject: Re: [Rcpp-devel] Defining template specialisation for wrap on
Windows 64bit (Compilation error: 'result_type' does not name a type)
Message-ID:
<C03F8157B6DECC428DE8D36DC5F9244116886EFEAA at DFW1MBX03.mex07a.mlsrvr.com>
Content-Type: text/plain; charset="us-ascii"
Sorry it didn't fix the problem. (I'd still recommend making the change for the reasons I gave.)
I don't see your follow up email yet, so I'll take a guess and say that you may be missing a "typename", something like:
typedef typename OUT result_type ;
This was my first thought on seeing the error; I've seen many like it and that's usually the reason.
But I couldn't convince myself of why the C++ rules would require a typename in that spot.
But the rules are sufficiently arcane that, in general, it's worth inserting a typename or two whenever the compiler says that something isn't what it "obviously" is (and templates are involved.)
(Support your local C++ compiler! It has a (provably) tough job to do. :-)
Good luck,
Steve
From: getoxxx at gmail.com [mailto:getoxxx at gmail.com] On Behalf Of Renaud Gaujoux
Sent: Friday, October 04, 2013 8:32 AM
To: Steve Jaffe
Cc: rcpp-devel at lists.r-forge.r-project.org
Subject: Re: [Rcpp-devel] Defining template specialisation for wrap on Windows 64bit (Compilation error: 'result_type' does not name a type)
Thanks for popping in Steve. I was full of hope when I read your reply!
Unfortunately I could not solve the issue with the changes you suggested.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20131004/4c509ae5/attachment.html>
------------------------------
_______________________________________________
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
End of Rcpp-devel Digest, Vol 48, Issue 10
******************************************
More information about the Rcpp-devel
mailing list