gfortran make 錯誤:“- 使用 -fPIC 重新編譯”

gfortran make 錯誤:“- 使用 -fPIC 重新編譯”

我在編譯 Fortran 程式時遇到錯誤:因為我提供了 makefile,所以我在終端機中開啟工作目錄並輸入make.不幸的是我收到這個錯誤:

relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
makefile:43: recipe for target '<name>' failed

實際上我不知道如何“用-fPIC重新編譯”。
我嘗試輸入make -fPIC並添加類似的內容:

CFLAGS = -fPIC
CXXFLAGS = -fPIC

到 makefile,但兩者都沒有工作。
如有任何幫助,我們將不勝感激,謝謝。

相關內容