![Fehler: #error Diese Datei erfordert Compiler- und Bibliotheksunterstützung für den ISO C++ 2011-Standard](https://rvso.com/image/191772/Fehler%3A%20%23error%20Diese%20Datei%20erfordert%20Compiler-%20und%20Bibliotheksunterst%C3%BCtzung%20f%C3%BCr%20den%20ISO%20C%2B%2B%202011-Standard.png)
Ich führe einen C++-Code mit TAU (Analyse- und Profilierungstool) auf Ubuntu 20.04 LTS mithilfe eines Clusters aus. Der von mir ausgeführte Befehl sieht folgendermaßen aus:
tau_cxx.sh -I$FFTW3_INC wrappingScript.cpp spectralFunctions.cpp arithmeticFunctions.cpp -optLinking="-lfftw3 -lm -g" -o ../../Datasim/TauTest.out
Dies führt jedoch zu folgendem Fehler:
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
Also habe ich versucht, -std=c++11
wie folgt zu kompilieren:
tau_cxx.sh -I$FFTW3_INC -std=c++11 wrappingScript.cpp spectralFunctions.cpp arithmeticFunctions.cpp -optLinking="-lfftw3 -lm -g" -o ../../Datasim/TauTest.out
Das bringt mich irgendwie durcheinander -I$FFTW3_INC
und ich bekomme Fehlermeldungen wie:
undefined reference to `fftw_malloc'
Ich habe versucht, es auch in meinen TAU-Optionen zu verknüpfen, wie:
tau_cxx.sh -I$FFTW3_INC wrappingScript.cpp spectralFunctions.cpp arithmeticFunctions.cpp -optLinking="-lfftw3 -lm -std=c++11 -g" -o ../../Datasim/TauTest.out
Dies hatte keine Wirkung und führte zu dem ursprünglichen Fehler. Kann mir bitte jemand helfen, ich bin verwirrt.
Antwort1
Nach dem Hinzufügen des (erforderlichen) -std=c++11
Flags (seltsam, der Standardwert ist mittlerweile -std=gnu++17
--d. h. ISO C++ 2017 + GNU-Erweiterungen--, was das Vorherige einschließen sollte) wird es kompiliert, aber die Definition für fftw_malloc
(vermutlich in einer Bibliothek) fehlt. Überprüfen Sie die Handbuchseite für fftw_malloc
, dort sollte Ihnen die richtige Beschwörungsformel angegeben sein. Wenn dies z. B. von einem aufgerufen wird Makefile
, überprüfen Sie alle Zeilen LIB =
oder Ähnliches.