我写了两只f档,分别是主程式、副程式,语法应该没有错误,却在编译时跳出错误讯息。
程式码如下:
主程式:
PROGRAM pr
REAL AA,BB,CC
AA = 9.0
BB = 5.0
CALL MY_SUB(AA,BB,CC)
END
副程式:
SUBROUTINE MY_SUB(A,B,C)
REAL A,B,C
C = A + B
WRITE(*,*) C
RETURN
END
编译时却分别跳出以下错误讯息:
/tmp/ccbidGKt.o: In function `MAIN__':
pr.f:(.text+0x32): undefined reference to `sub_'
collect2:error :ld returned 1 exit status
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../lib64/crtl.o: In function
`_start':
(.text+0x20): undefined reference to `main'
collect2:error :ld returned 1 exit status
请问这是怎么回事?