[Rcpp-devel] Conflict of std::asin and std::tr1::asin while using RcppArmadillo
Dirk Eddelbuettel
edd at debian.org
Wed Jun 22 12:34:32 CEST 2016
Robin,
On 22 June 2016 at 12:11, Robin Girard wrote:
| Dear Rcpp experts,
|
| I'm using RcppArmadillo and I'm facing a conflict on the asin, acos, atan and fabs functions I hardly manage to understand (the conflict appears under linux but not under windows)
|
| - -------- My header looks like this :
I _complete and self-contained_ example would help us. Nobody can really
help with the partial snippet below.
| #define ARMA_DONT_USE_CXX11
| #include "R.h" // R functions
|
| #include <RcppArmadillo.h>
| #include <assert.h>
|
| #include <netcdf>
| #include <cstdlib>
| #include <cstring>
| #include <iostream>
| #include <solar_geometry.h>
| #include <clsmodel.h>
| using namespace Rcpp;
| using namespace RcppArmadillo;
| //
| using namespace netCDF;
| using namespace netCDF::exceptions;
|
| ---------- the compilation runs like this
| g++ -m64 -I/usr/include/R -DNDEBUG -std=c++0x -I../inst/include/ -I/usr/include /usr/local/include -I"/usr/lib64/R/include" -I/usr/local/include -I"/usr/lib64/R/library/RcppArmadillo/include" -I"/usr/lib64/R/library/Rcpp/include" `/usr/lib64/R/bin/Rscript -e "Rcpp:::CxxFlags()"` `pkg-config --cflags netcdf` /usr/local/include -fopenmp -lnetcdf -lnetcdf.7 -lnetcdf_c++4 -lsolar_geometry -lclsmodel -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c Module.cc -o Module.o
|
|
|
| ---------- and the error message has
| In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/tr1/complex:47,
I would start by trying a compiler from this decade.
The g++ 4.4.7 release on these older RedHat machines is getting long in the
tooth. In fact, the _current_ RcppArmadillo release (on CRAN, as well as on
GitHub) even tests for versions that old and _dies in error_ if 4.4 or 4.5 is
found.
So try g++ 4.6, better still 4.8/4.9 or a 5* variant. If you can't then you
may have to use (Rcpp)Armadillo versions from that timeframe.
Dirk
| from /usr/lib64/R/library/RcppArmadillo/include/armadillo:74,
| from /usr/lib64/R/library/RcppArmadillo/include/RcppArmadilloForward.h:46,
| from /usr/lib64/R/library/RcppArmadillo/include/RcppArmadillo.h:30,
| from ../inst/include/FluctRES.h:18,
| from Module.cc:9:
| /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/tr1_impl/complex:40: error: ‘template<class _Tp> std::complex<_Tp> std::tr1::acos(const std::complex<_Tp>&)’ conflicts with previous using declaration ‘template<class _Tp> std::complex<_Tp> std::acos(const std::complex<_Tp>&)’
|
|
| ---
| I tried to call std::acos ... instead of acos in my code but the error is still here. Sorry that my example is not really "elementary" and I hope I'm on the right list..
| I guess I'm including twice something by wrong use of using namespace and I saw that #define ARMA_DONT_USE_CXX11 implies the load of #include <tr1/complex> (in file armadillo)
|
| Is any help possible from this mailing list ?
| Thanks in advance
| Best regards
| Robin
|
|
| Dr. Girard Robin
| Chargé de Recherche
|
| MINES-ParisTech /PSL Research University/ Département Energétique et Procédés / PERSEE / Groupe ERSEI
| Centre Procédés, Energies Renouvelables et Systèmes Energétiques (PERSEE)
| Center for Processes, Renewables Energies and Energy Systems
| Renewable Energies & Smartgrids (ERSEI)
|
| 1 Rue Claude Daunesse - CS 10207 - F-06904 Sophia Antipolis Cedex
| Tel: +33.4.93.67.89.64 (~99), Fax: +33.4.93.95.75.35
| e-mail : robin.girard at mines-paristech.fr
|
| web page perso http://www.mines-paristech.fr/Services/Annuaire/&?id=8828
| statoverflow : http://stats.stackexchange.com/users/223/robin-girard
| web page centre PERSEE : http://www.cep.mines-paristech.fr/
| linkedin : http://www.linkedin.com/profile/view?id=14907272&trk=tab_pro
|
| Le lien vaut mieux que le bien.
| ________________________________________________________
|
| CONFIDENTIALITY : This e-mail and any attachments are
| confidential and may be privileged. If you are not a
| named recipient, please notify the sender immediately and
| do not disclose the contents to another person, use it for
| any purpose or store or copy the information in any medium.
|
| CONFIDENTIALITE : Ce message et les éventuelles pièces
| attachées sontconfidentiels et peuvent être une
| communication protégée. Si vous n'êtes pas dans la liste
| des destinataires, veuillez informer l'expéditeur
| immédiatement et ne pas ouvrir ni divulguer le contenu
| à une tierce personne, ne pas l'utiliser pour quelque
| raison que ce soit, ne pas stocker ou copier l'information
| qu'il contient sur un quelconque support.
|
|
| _______________________________________________
| 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
--
While traveling abroad, the router hung which left me unable to access email
for a few days (and also blocked access to my website, blog, @cranberries, ...)
Please accept my apologies for delayed and/or somewhat brief replies.
--
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
More information about the Rcpp-devel
mailing list