エラー: #error このファイルには、ISO C++ 2011 標準のコンパイラとライブラリのサポートが必要です

エラー: #error このファイルには、ISO C++ 2011 標準のコンパイラとライブラリのサポートが必要です

私は、あるクラスターを使用して、Ubuntu 20.04 LTS で TAU (分析およびプロファイリング ツール) を使用して C++ コードを実行しています。実行しているコマンドは次のようになります。

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

しかし、次のエラーが発生します。

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

そこで、次のようにコンパイルしてみました-std=c++11:

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

これにより、何らかの理由で混乱が生じ-I$FFTW3_INC、次のようなエラーが発生します。

undefined reference to `fftw_malloc'

次のようにTAUオプションにリンクすることも試しました:

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

これは効果がなく、元のエラーが発生しました。誰か助けてください。混乱しています。

答え1

(必須)-std=c++11フラグを追加した後 (奇妙ですが、現在のデフォルトは-std=gnu++17--つまり、ISO C++ 2017 + GNU 拡張機能 -- であり、これには前のものが含まれているはずです)、コンパイルはできますが、 の定義fftw_malloc(おそらく何らかのライブラリ内) がありません。 のマニュアル ページを確認するとfftw_malloc、正しい構文がわかるはずです。 これが などから呼び出される場合は、行などをMakefile確認してください。LIB =

関連情報