Dear list,
I've noticed a small thing when compiling a .cpp file on windows. Following the
Rcpp FAQ document I do
C:\Documents\teaching\2012-ASC\presentations\callingC>Rscript -e
"Rcpp:::SHLIB('matprod5.cpp')"
------------------------------------
Sørens .Rprofile in c:/Documents
------------------------------------
Working directory is: C:/Documents/teaching/2012-ASC/presentations/callingC
Calling .First() in .Rprofile
exiting .First()
g++ -m64 -shared -s -static-libgcc -o matprod5.dll tmp.def matprod5.o
------------------------------------ S▒rens .Rprofile in c:/Documents
-------------------------
----------- Working directory is:
C:/Documents/teaching/2012-ASC/presentations/callingC Calling .First() in
.Rprofile exiting .First() C:/programs/R/current/library/
Rcpp/lib/x64/libRcpp.aCalling .Last() in .Rprofile
-Ld:/RCompile/CRANpkg/extralibs64/local/lib/x64
-Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/programs/R/curren
t/bin/x64 -lR
g++.exe: error: S?rens: Invalid argument
g++.exe: error: .Rprofile: No such file or directory
g++.exe: error: in: No such file or directory
... bla bla bla ...
This is due to a .First() function etc. in my .Rprofile. I then try to use
--vanilla with a similar result
C:\Documents\teaching\2012-ASC\presentations\callingC>Rscript --vanilla -e
"Rcpp:::SHLIB('matprod5.cpp')"
g++ -m64 -shared -s -static-libgcc -o matprod5.dll tmp.def matprod5.o
------------------------------------ S▒rens .Rprofile in c:/Documents
-------------------------
----------- Working directory is:
C:/Documents/teaching/2012-ASC/presentations/callingC Calling .First() in
.Rprofile exiting .First() C:/programs/R/current/library/
Rcpp/lib/x64/libRcpp.aCalling .Last() in .Rprofile
-Ld:/RCompile/CRANpkg/extralibs64/local/lib/x64
-Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/programs/R/curren
t/bin/x64 -lR
g++.exe: error: S?rens: Invalid argument
g++.exe: error: .Rprofile: No such file or directory
g++.exe: error: in: No such file or directory
....
I would have thought that the --vanilla option would make things work. Am I
overlooking something or is that a bug??
(If I remove the .First() function etc. from my .Rprofile then everything works
fine. )
The other option mentioned in the FAQ is to do:
R --vanilla CMD SHLIB matprod5.cpp
- and that works fine (it doesn't if I omit --vanilla). This works because I
have created a Makevars file with the lines:
PKG_LIBS=`Rscript -e "Rcpp:::LdFlags()"`
PKG_CXXFLAGS=`Rscript -e "Rcpp:::CxxFlags()"`
According to the FAQ, each line should start with 'export' but that is a *nix
command, not a windows command. Perhaps it would be worthwhile mentioning this
in the faq.
Best regards
Søren
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel