Skip to content

[Rcpp-devel] RcppArmadillo trying to compile rcpparma_hello_world.cpp

4 messages · Dirk Eddelbuettel, Andre Mikulec

#
Hi,

I am trying to compile the RcppArmadillo example

R CMD SHLIB rcpparma_hello_world.cpp
...

The following message is returned.


\RcppArmadillo_0.3.800.1\skeleton>R CMD SHLIB rcpparma_hello_world.cpp

M:\YDrive\All_Economics\eclipse_workspace\RcppArmadillo_0.3.800.1\skeleton>R CMD SHLIB rcpparma_hello_world.cpp
g++ -m32 -I"F:/ProgramFiles/R/R-2.15.3/include" -DNDEBUG ? ? -I"d:/RCompile/CRANpkg/extralibs64/local/include" ?-IF:/ProgramFiles/R/R-2.15.3/include -IF:/ProgramFiles/R/R-2.15.3/include/i386 -IF:/ProgramFiles/R/R-2.15.3/library/Rcpp/include -IM:/YDrive/Al
l_Economics/eclipse_workspace/RcppArmadillo_0.3.800.1/include ? -O2 -Wall ?-mtune=core2 -c rcpparma_hello_world.cpp -o rcpparma_hello_world.o
In file included from rcpparma_hello_world.cpp:1:0:
rcpparma_hello_world.h:1:10: warning: extra tokens at end of #ifndef directive [enabled by default]
rcpparma_hello_world.h:2:10: warning: missing whitespace after the macro name [enabled by default]
In file included from F:/ProgramFiles/R/R-2.15.3/library/Rcpp/include/RcppCommon.h:102:0,
? ? ? ? ? ? ? ? ?from MYLONGPATH/RcppArmadillo_0.3.800.1/include/RcppArmadilloForward.h:25,
? ? ? ? ? ? ? ? ?from MYLONGPATH/RcppArmadillo_0.3.800.1/include/RcppArmadillo.h:29,
? ? ? ? ? ? ? ? ?from rcpparma_hello_world.h:4,
? ? ? ? ? ? ? ? ?from rcpparma_hello_world.cpp:1:
F:/ProgramFiles/R/R-2.15.3/library/Rcpp/include/Rcpp/Named.h:64:1: error: stray '@' in program
F:/ProgramFiles/R/R-2.15.3/library/Rcpp/include/Rcpp/Named.h:64:1: error: stray '@' in program
In file included from F:/ProgramFiles/R/R-2.15.3/library/Rcpp/include/RcppCommon.h:102:0,
? ? ? ? ? ? ? ? ?from MYLONGPATH/RcppArmadillo_0.3.800.1/include/RcppArmadilloForward.h:25,
? ? ? ? ? ? ? ? ?from MYLONGPATH/RcppArmadillo_0.3.800.1/include/RcppArmadillo.h:29,
? ? ? ? ? ? ? ? ?from rcpparma_hello_world.h:4,
? ? ? ? ? ? ? ? ?from rcpparma_hello_world.cpp:1:
F:/ProgramFiles/R/R-2.15.3/library/Rcpp/include/Rcpp/Named.h:64:35: error: expected initializer before '_RCPP_HELLO_WORLD_H'
make: *** [rcpparma_hello_world.o] Error 1

Please help

Thank you,
Andre Mikulec
Andre_Mikulec at Hotmail.com
#
Andre,

Not reproducible, and you didn't tell us

    - what OS and version
    - what compiler and version
    - what Rcpp version
    - what RcppArmadillo version

etc pp.  Try to redo the following at your end:

R> setwd("/tmp")
R> library(RcppArmadillo)
R> RcppArmadillo.package.skeleton("testpackage")
Creating directories ...
Creating DESCRIPTION ...
Creating NAMESPACE ...
Creating Read-and-delete-me ...
Saving functions and data ...
Making help files ...
Done.
Further steps are described in './testpackage/Read-and-delete-me'.

Adding RcppArmadillo settings
 >> added Depends: Rcpp, RcppArmadillo
 >> added LinkingTo: Rcpp, RcppArmadillo
 >> added useDynLib directive to NAMESPACE
 >> added Makevars file with Rcpp settings
 >> added Makevars.win file with RcppArmadillo settings
 >> added example header file using Rcpp/RcppArmadillo
 >> added example src file using armadillo classes
 >> added example R file calling the C++ example
R> system("R CMD INSTALL testpackage")
* installing to library ?/usr/local/lib/R/site-library?
* installing *source* package ?testpackage? ...
** libs
ccache g++-4.7 -I/usr/share/R/include -DNDEBUG   -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/RcppArmadillo/include"   -fpic  -g0 -O3 -Wall -pipe -Wno-variadic-macros -pedantic -c rcpparma_hello_world.cpp -o rcpparma_hello_world.o
g++-4.7 -shared -o testpackage.so rcpparma_hello_world.o -L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/testpackage/libs
** R
** preparing package for lazy loading
** help
Warning: /tmp/testpackage/man/testpackage-package.Rd:32: All text must be in a section
*** installing help indices
** building package indices
** testing if installed package can be loaded

* DONE (testpackage)
R> 

followed later by

R> system("R CMD REMOVE testpackage")
Removing from library ?/usr/local/lib/R/site-library?
R> 


Dirk
#
All,

OS: Microsoft Windows XP SP3 32 bit
compiler: gcc version 4.6.3 20111208 (prerelease) (GCC) ? ( from Rtools folder )
RcppArmadillo : Version: 0.3.800.1
Rcpp: Version: 0.10.3
Creating directories ...
Creating DESCRIPTION ...
Creating NAMESPACE ...
Creating Read-and-delete-me ...
Saving functions and data ...
Making help files ...
Done.
Further steps are described in './testpackage/Read-and-delete-me'.

Adding RcppArmadillo settings
?>> added Depends: Rcpp, RcppArmadillo
?>> added LinkingTo: Rcpp, RcppArmadillo
?>> added useDynLib directive to NAMESPACE
?>> added Makevars file with Rcpp settings
?>> added Makevars.win file with RcppArmadillo settings
?>> added example header file using Rcpp/RcppArmadillo
?>> added example src file using armadillo classes
?>> added example R file calling the C++ example
* installing to library 'F:/Program Files/RStudio/R/library'
* installing *source* package 'testpackage' ...
** libs
g++ -m32 -I"F:/PROGRA~2/R/R-215~1.3/include" -DNDEBUG ? ?-I"F:/ProgramFiles/R/R-2.15.3/library/Rcpp/include" -I"F:/ProgramFiles/R/R-2.15.3/library/RcppArmadillo/include" -I"d:/RCompile/CRANpkg/extralibs64/local/include" ? ? -O2 -Wall ?-mtune=core2 -c rcpparma_hello_world.cpp -o rcpparma_hello_world.o
g++ -m32 -shared -s -static-libgcc -o testpackage.dll tmp.def rcpparma_hello_world.o F:/ProgramFiles/R/R-2.15.3/library/Rcpp/lib/i386/libRcpp.a -LF:/PROGRA~2/R/R-215~1.3/bin/i386 -lRlapack -LF:/PROGRA~2/R/R-215~1.3/bin/i386 -lRblas -lgfortran -Ld:/RCompile/CRANpkg/extralibs64/local/lib/i386 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LF:/PROGRA~2/R/R-215~1.3/bin/i386 -lR
installing to F:/Program Files/RStudio/R/library/testpackage/libs/i386
** R
** preparing package for lazy loading
** help
Warning: M:/YDrive/All_Economics/eclipse_workspace/myvistudrccppackage/testpackage/man/testpackage-package.Rd:33: All text must be in a section
Warning: M:/YDrive/All_Economics/eclipse_workspace/myvistudrccppackage/testpackage/man/testpackage-package.Rd:34: All text must be in a section
*** installing help indices
** building package indices
** testing if installed package can be loaded

* DONE (testpackage)
Removing from library 'F:/Program Files/RStudio/R/library'



O.K.

I found

testpackage\src\rcpparma_hello_world.o
testpackage\src\rcpparma_hello_world.dll

Thats good for right now.


Thank you,
Andre Mikulec
Andre_Mikulec at Hotmail.com



----------------------------------------
#
On 31 March 2013 at 22:47, Andre Mikulec wrote:
| Thats good for right now.

Yes.

Your earlier mistake was to assume that you could do R CMD SHLIB on a file
containing Rcpp and RcppArmadillo.  And you cannot -- as one needs -I setting
for includes, -L for libraries for Rcpp, for RcppArmadillo, etc pp.

Either use a (small) package, as you now did via the skeleton, or use Rcpp
Attributes with proper depends.  There are examples in the list archives, and
on http://gallery.rcpp.org.

Dirk