Atualmente estou trabalhando com Ubuntu 16.04.3 LTS. Você deve saber que conheço completamente qualquer ambiente Linux, então, desculpe minha falta de detalhes, se houver.
Tenho que trabalhar com a biblioteca ROOT para C++, desenvolvida pelo CERN. A instalação com sudo make install
falhou e tive que instalá-la através do cmake
.
Quando inicio um terminal e digito root
, parece funcionar, exibindo todas as informações corretamente.
No entanto, ao usar o seguinte makefile
(incluído no final da postagem), recebo um relatório de erros realmente extenso que começa com:
g++ -Wall -c -o Precision_DiffFinie.o -I`~/root-6.12.04/builddir/bin/root-config --incdir` Precision_DiffFinie.cpp
In file included from /home/benjamin/root-6.12.04/builddir/include/RtypesCore.h:23:0,
from /home/benjamin/root-6.12.04/builddir/include/Rtypes.h:23,
from /home/benjamin/root-6.12.04/builddir/include/TObject.h:17,
from /home/benjamin/root-6.12.04/builddir/include/TNamed.h:25,
from /home/benjamin/root-6.12.04/builddir/include/TGraph.h:24,
from Precision_DiffFinie.cpp:15:
/home/benjamin/root-6.12.04/builddir/include/RConfig.h:47:4: error: #error "ROOT requires support for C++11 or higher."
# error "ROOT requires support for C++11 or higher."
^
/home/benjamin/root-6.12.04/builddir/include/RConfig.h:49:5: error: #error "Pass `-std=c++11` as compiler argument."
#error "Pass `-std=c++11` as compiler argument."
^
In file included from /usr/include/c++/5/atomic:38:0,
from /home/benjamin/root-6.12.04/builddir/include/Rtypes.h:29,
from /home/benjamin/root-6.12.04/builddir/include/TObject.h:17,
from /home/benjamin/root-6.12.04/builddir/include/TNamed.h:25,
from /home/benjamin/root-6.12.04/builddir/include/TGraph.h:24,
from Precision_DiffFinie.cpp:15:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \
Acho que os erros a seguir se devem ao fato de o compilador C++ não entender o que escrevi, pois não conseguiu vincular à biblioteca ROOT.
Alguém sabe como consertar isso ou pode me explicar o que estou fazendo de errado? Tentei fazer tudo bem, mas certamente perdi alguma coisa; e tenho tentado consertar isso há muito tempo para entender alguma coisa sozinho agora.
O makefile
:
# Makefile pour les exercices de calculs numeriques
# definition du compilateur
GPP=g++ -Wall
# lien vers les fichiers d'en-tete des classes ROOT (ROOTINC) et les librairies (ROOTLIB), cad les fichiers binaires
ROOTINC=-I`root-config --incdir`
ROOTLIB=`root-config --libs`
#La liste des executables a compiler
# les executables sont en .exe pour pouvoir beneficier de la regle generique de conversion de .o en .exe
EXE=MinMaxTableau.exe Optimisation_CalculSerie.exe Precision_DiffFinie.exe MethodeSecante.exe
#######################################################################################
# la premiere instruction du makefile est celle par défaut - quand on tape make sans donner d'argument après
all: ${EXE}
#######################################################################################
# Compilation
# Des classes
%.o:%.cpp %.h
${GPP} -c -o $@ ${ROOTINC} $<
# Des programmes principaux
%.o:%.cpp
${GPP} -c -o $@ ${ROOTINC} $<
#######################################################################################
# Edition des liens
# Regle de conversion de chaque .o en .exe
%.exe: %.o
${GPP} -o $@ $^ ${ROOTLIB}
#######################################################################################
# nettoyage
clean:
rm -rf *.o ${EXE} *.pdf *.root *.png Print
Muito obrigado.
Responder1
eu vejo issocompilações comuns make
não são recomendadas pelo CERN, mas você pode tentar.
wget https://root.cern.ch/download/root_v6.12.04.source.tar.gz
tar -xzf root_v6.12.04.source.tar.gz
sudo apt-get install git dpkg-dev cmake g++ gcc binutils libx11-dev libxpm-dev \
libxft-dev libxext-dev
sudo apt-get install gfortran libssl-dev libpcre3-dev \
xlibmesa-glu-dev libglew1.5-dev libftgl-dev \
libmysqlclient-dev libfftw3-dev libcfitsio-dev \
graphviz-dev libavahi-compat-libdnssd-dev \
libldap2-dev python-dev libxml2-dev libkrb5-dev \
libgsl0-dev libqt4-dev
./configure
make -j4
sudo make install
Também para sua informação - Ubuntu Xenial temPacotes ROOT 5.34 em repositórios. Você pode instalá-los com
sudo apt-get install root-system-bin