在構建我的代碼時,我收到幾個語句函數的「未定義的引用錯誤...」錯誤。它編譯成功。構建幾個語句函數的代碼時出現未定義的引用錯誤
我的程序代碼部分在定義了必要的參數和尺寸後,從下面的語句函數開始。另外,模塊的CONTAINS
部分還有其他功能/子程序。
PROGRAM ......
DIMENSIONS bla bla
!***** FUNCTIONS *****
!***FREE ENERGIES PER VOLUME OF INDIVIDUAL PHASES
FL(X)=((1.-X)*GCU_L+R*T*((1.-X)*DLOG(1.-X)))
DFI(X)=2.*CC*(X-0.435)/VM
*****************************
VM=20.65D-6
R=8.3145
T=250. + 273.
TEMP=T
GCU_L=5194.277+120.973331*T
bla bla
END PROGRAM
構建的錯誤,我收到:
gfortran -Wall -o "123456" "123456.f90" (in directory: /Geany)
/tmp/ccwapaHQ.o: In function `__mymodule_MOD_fsteady':
123456.f90:(.text+0x7e3a): undefined reference to `fl_'
123456.f90:(.text+0x7ea9): undefined reference to `dfi_'
**DELETED THE REST**
collect2: error: ld returned 1 exit status
Compilation failed.
我想複製聲明功能,包含我模塊的部分可能會解決錯誤。然而,它產生以下編譯錯誤...
gfortran -Wall -c "123456.f90" (in directory: /Geany)
Compilation failed.
123456.f90:523.127:
FL(X)=((1.-X)*GCU_L+R*T*((1.-X)*DLOG(1.-X)))
1
DFI(X)=2.*CC*(X-0.435)/VM
1
Error: Unexpected STATEMENT FUNCTION statement in CONTAINS section at (1)
123456.f90:1332.16:
USE myModule
1
Fatal Error: Can't open module file 'mymodule.mod' for reading at (1): No such file or directory
我想,在第一種情況下,你在'mymodule'模塊的'fsteady'過程中引用了'fl'。你能證實,證明嗎? – francescalus
是的。你是對的。那我該怎麼辦? – Vahid