Erro: #error Este arquivo requer suporte de compilador e biblioteca para o padrão ISO C++ 2011

Erro: #error Este arquivo requer suporte de compilador e biblioteca para o padrão ISO C++ 2011

Estou executando um código c++ com TAU (ferramenta de análise e criação de perfil) no Ubuntu 20.04 LTS usando algum cluster. O comando que estou executando é assim:

tau_cxx.sh -I$FFTW3_INC wrappingScript.cpp spectralFunctions.cpp arithmeticFunctions.cpp -optLinking="-lfftw3 -lm -g" -o ../../Datasim/TauTest.out

No entanto, isso está me dando o seguinte erro:

Executing> /opt/apps/gcc/5.2.0/bin/g++ -I/opt/apps/gcc5_2/mvapich22_2/fftw/3.3.8/include wrappingScript.cpp spectralFunctions.cpp arithmeticFunctions.cpp -o ../../Datasim/TauTest.out
In file included from /arcapps/cascades-broadwell-slurm/opt/apps/gcc/5.2.0/include/c++/5.2.0/cstdint:35:0,
                 from arithmeticFunctions.cpp:8:
/arcapps/cascades-broadwell-slurm/opt/apps/gcc/5.2.0/include/c++/5.2.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \
  ^

make: *** [all] Error 1

Então tentei compilar -std=c++11assim:

tau_cxx.sh -I$FFTW3_INC -std=c++11 wrappingScript.cpp spectralFunctions.cpp arithmeticFunctions.cpp -optLinking="-lfftw3 -lm -g" -o ../../Datasim/TauTest.out

Isso de alguma forma atrapalha -I$FFTW3_INCe recebo erros como:

undefined reference to `fftw_malloc'

Tentei também vinculá-lo em minhas opções de TAU como:

tau_cxx.sh -I$FFTW3_INC wrappingScript.cpp spectralFunctions.cpp arithmeticFunctions.cpp -optLinking="-lfftw3 -lm -std=c++11 -g" -o ../../Datasim/TauTest.out

Isso não teve efeito e me deu o erro original. Alguém pode ajudar, por favor, estou confuso.

Responder1

Depois de adicionar o sinalizador (obrigatório) -std=c++11(estranho, o padrão agora é -std=gnu++17--ou seja, extensões ISO C++ 2017 + GNU-- que deve incluir o anterior), você o compila, mas a definição para fftw_malloc(presumivelmente em alguma biblioteca) está desaparecido. Verifique a página do manual fftw_malloc, ela deve informar o encantamento correto. Se isso for chamado, por exemplo, de a Makefile, verifique todas as linhas LIB =ou algo semelhante.

informação relacionada