일부 클러스터를 사용하여 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
--ie, ISO C++ 2017 + GNU 확장입니다. 이전 항목을 포함해야 함) 컴파일할 수 있지만 fftw_malloc
(아마도 일부 라이브러리에 있는) 정의는 누락. 매뉴얼 페이지를 확인하면 fftw_malloc
올바른 주문을 알려줄 것입니다. 예를 들어 a에서 호출되는 경우 줄이나 이와 유사한 Makefile
항목을 확인하세요 LIB =
.