![エラー: #error このファイルには、ISO C++ 2011 標準のコンパイラとライブラリのサポートが必要です](https://rvso.com/image/191772/%E3%82%A8%E3%83%A9%E3%83%BC%3A%20%23error%20%E3%81%93%E3%81%AE%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%81%AB%E3%81%AF%E3%80%81ISO%20C%2B%2B%202011%20%E6%A8%99%E6%BA%96%E3%81%AE%E3%82%B3%E3%83%B3%E3%83%91%E3%82%A4%E3%83%A9%E3%81%A8%E3%83%A9%E3%82%A4%E3%83%96%E3%83%A9%E3%83%AA%E3%81%AE%E3%82%B5%E3%83%9D%E3%83%BC%E3%83%88%E3%81%8C%E5%BF%85%E8%A6%81%E3%81%A7%E3%81%99.png)
私は、あるクラスターを使用して、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 =