[Rcpp-devel] Fwd: cannot compile qtdensity example on windows

Michele Gubian mm14722 at bristol.ac.uk
Mon May 19 20:04:45 CEST 2014


hi Dirk,

I tried to do the following (I am not sure I understand your
suggestion, since I am a newbie)
- modified the order of -I options in g++. This made no difference.
Probably this was not what you meant.
-  I moved
#include <RInside.h>
after all the #include <QSomething> in  qtdensity.h
Now the errors are even more, and different from before. A reduced
output obtained by using g++ -E is reported below.

Going back to the original error, g++ complains about Realloc and Free
definitions. This is similar to the problem in this post:
http://stackoverflow.com/questions/11588765/using-rcpp-with-windows-specific-includes

but I don't know how to apply it to my case.

=====begin output from g++ oE ====
command:
g++  -E -c -pipe -fno-keep-inline-dllexport
-IC:/PROGRA~1/R/R-31~1.0/library/Rcpp/include
-IC:/PROGRA~1/R/R-31~1.0/library/RInside/include -O2 -frtti -Wall
-Wextra -fexceptions -mthreads -DUNICODE -DQT_NO_DEBUG -DQT_SVG_LIB
-DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I.
-I../../../../../programmi/Qt/5.2.1/mingw48_32/include
-I../../../../../programmi/Qt/5.2.1/mingw48_32/include/QtSvg
-I../../../../../programmi/Qt/5.2.1/mingw48_32/include/QtWidgets
-I../../../../../programmi/Qt/5.2.1/mingw48_32/include/QtGui
-I../../../../../programmi/Qt/5.2.1/mingw48_32/include/QtCore
-Irelease -I../../../../../programmi/Qt/5.2.1/mingw48_32/mkspecs/win32-g++
 -IC:/PROGRA~1/R/R-31~1.0/include
-IC:/PROGRA~1/R/R-31~1.0/include/i386 -o release/qtdensity.o
qtdensity.cpp

output:

In file included from C:/PROGRA~1/R/R-31~1.0/include/R.h:50:0,
                 from
C:/PROGRA~1/R/R-31~1.0/library/Rcpp/include/RcppCommon.h:36,
                 from C:/PROGRA~1/R/R-31~1.0/library/Rcpp/include/Rcpp.h:27,
                 from
C:/PROGRA~1/R/R-31~1.0/library/RInside/include/RInsideCommon.h
:38,
                 from
C:/PROGRA~1/R/R-31~1.0/library/RInside/include/RInside.h:26,
                 from qtdensity.h:28,
                 from qtdensity.cpp:8:
C:/PROGRA~1/R/R-31~1.0/include/R_ext/RS.h:45:0: warning: "ERROR"
redefined [enabled
by default]
 #define ERROR   ),error(R_problem_buf);}
 ^
In file included from
c:\users\uasolo\faldone\programmi\qt\tools\mingw48_32\i686-w64
-mingw32\include\windows.h:71:0,
                 from
../../../../../programmi/Qt/5.2.1/mingw48_32/include/QtCore/qt
_windows.h:71,
                 from
../../../../../programmi/Qt/5.2.1/mingw48_32/include/QtGui/qop
engl.h:51,
                 from
../../../../../programmi/Qt/5.2.1/mingw48_32/include/QtGui/qop
englcontext.h:62,
                 from
../../../../../programmi/Qt/5.2.1/mingw48_32/include/QtGui/QtG
ui:32,
                 from qtdensity.h:12,
                 from qtdensity.cpp:8:
c:\users\uasolo\faldone\programmi\qt\tools\mingw48_32\i686-w64-mingw32\include\wingd
i.h:74:0: note: this is the location of the previous definition
 #define ERROR 0
 ^

=====end output from g++ oE ====

On 19 May 2014 15:12, Dirk Eddelbuettel <edd at debian.org> wrote:
>
> On 19 May 2014 at 15:07, Michele Gubian wrote:
> | ---------- Forwarded message ----------
> | From: Michele Gubian <mm14722 at bristol.ac.uk>
> | Date: 19 May 2014 14:39
> | Subject: Re: [Rcpp-devel] cannot compile qtdensity example on windows
> | To: Dirk Eddelbuettel <edd at debian.org>
> |
> |
> | dear Dirk,
> |
> | ok, I will try to compile everything from sources, R, Qt and the rest.
> | However, the post
> |  http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2012-November/004771.html
> | says that it is not necessary.
> |
> | Please have a look at the compilation errors I got, which I copy
> | below. It might be that you recognize something, e.g. changes in new
> | versions.
> | I let you know about my progress.
> | Many thanks
> | Michele
> |
> | output from mingw32-make -f Makefile follows:
> |
> | mingw32-make -f Makefile.Release
> | mingw32-make[1]: Entering directory
> | 'C:/Users/Uasolo/faldone/work/Bristol/Qt/RInside/qt'
> | g++ -c -pipe -fno-keep-inline-dllexport
> | -IC:/PROGRA~1/R/R-31~1.0/include -IC:/PROGRA~1/R/R-31~1.0/include/i386
> | -IC:/PROGRA~1/R/R-31~1.0/library/Rcpp/include
> | -IC:/PROGRA~1/R/R-31~1.0/library/RInside/include -O2 -frtti -Wall
> | -Wextra -fexceptions -mthreads -DUNICODE -DQT_NO_DEBUG -DQT_SVG_LIB
> | -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I.
> | -I'../../../../../programmi/Qt/5.2.1/mingw48_32/include'
> | -I'../../../../../programmi/Qt/5.2.1/mingw48_32/include/QtSvg'
> | -I'../../../../../programmi/Qt/5.2.1/mingw48_32/include/QtWidgets'
> | -I'../../../../../programmi/Qt/5.2.1/mingw48_32/include/QtGui'
> | -I'../../../../../programmi/Qt/5.2.1/mingw48_32/include/QtCore'
> | -I'release' -I'../../../../../programmi/Qt/5.2.1/mingw48_32/mkspecs/win32-g++'
> | -o release/qtdensity.o qtdensity.cpp
> | In file included from
> | c:\users\uasolo\faldone\programmi\qt\tools\mingw48_32\i686-w64-mingw32\include\objbase.h:159:0,
> |                  from
> | c:\users\uasolo\faldone\programmi\qt\tools\mingw48_32\i686-w64-mingw32\include\ole2.h:16,
> |                  from
> | c:\users\uasolo\faldone\programmi\qt\tools\mingw48_32\i686-w64-mingw32\include\wtypes.h:12,
> |                  from
> | c:\users\uasolo\faldone\programmi\qt\tools\mingw48_32\i686-w64-mingw32\include\winscard.h:10,
> |                  from
> | c:\users\uasolo\faldone\programmi\qt\tools\mingw48_32\i686-w64-mingw32\include\windows.h:97,
> |                  from
> | ../../../../../programmi/Qt/5.2.1/mingw48_32/include/QtCore/qt_windows.h:71,
> |                  from
> | ../../../../../programmi/Qt/5.2.1/mingw48_32/include/QtGui/qopengl.h:51,
> |                  from
> | ../../../../../programmi/Qt/5.2.1/mingw48_32/include/QtGui/qopenglcontext.h:62,
> |                  from
> | ../../../../../programmi/Qt/5.2.1/mingw48_32/include/QtGui/QtGui:32,
> |                  from qtdensity.h:13,
> |                  from qtdensity.cpp:8:
> | c:\users\uasolo\faldone\programmi\qt\tools\mingw48_32\i686-w64-mingw32\include\objidl.h:618:52:
> | error: macro "Realloc" requires 3 arguments, but only 2 given
> |      virtual void *WINAPI Realloc(void *pv,SIZE_T cb) = 0;
> |                                                     ^
>
> That is a common and fairly standard problem of having R macros seep into
> other headers.
>
> You need to avoid it.  One way is to include the R headers after the Qt headers.
>
> Dirk
>
> --
> Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list