如何使用包含头文件和C预处理器宏编译程序?

时间:2016-07-23 12:03:24

标签: fortran

我的平均程序中包含头文件-- Logs begin at Sat 2016-07-23 12:41:36 UTC, end at Sat 2016-07-23 12:44:19 UTC. -- Jul 23 12:43:06 anudemon-master-00 systemd[1]: Started Kubernetes API Server. Jul 23 12:43:06 anudemon-master-00 kube-apiserver[1964]: I0723 12:43:06.299966 1964 server.go:188] Will report 172.16.0.4 as public IP address. Jul 23 12:43:06 anudemon-master-00 kube-apiserver[1964]: F0723 12:43:06.300057 1964 server.go:211] Cloud provider could not be initialized: unknown cloud provider "vagrant" Jul 23 12:43:06 anudemon-master-00 systemd[1]: kube-apiserver.service: Main process exited, code=exited, status=255/n/a Jul 23 12:43:06 anudemon-master-00 systemd[1]: kube-apiserver.service: Unit entered failed state. Jul 23 12:43:06 anudemon-master-00 systemd[1]: kube-apiserver.service: Failed with result 'exit-code'. Jul 23 12:43:16 anudemon-master-00 systemd[1]: kube-apiserver.service: Service hold-off time over, scheduling restart. Jul 23 12:43:16 anudemon-master-00 systemd[1]: Stopped Kubernetes API Server. Jul 23 12:43:16 anudemon-master-00 kube-apiserver[2015]: I0723 12:43:16.428476 2015 server.go:188] Will report 172.16.0.4 as public IP address. Jul 23 12:43:16 anudemon-master-00 kube-apiserver[2015]: F0723 12:43:16.428534 2015 server.go:211] Cloud provider could not be initialized: unknown cloud provider "vagrant" Jul 23 12:43:16 anudemon-master-00 systemd[1]: Started Kubernetes API Server. Jul 23 12:43:16 anudemon-master-00 systemd[1]: kube-apiserver.service: Main process exited, code=exited, status=255/n/a Jul 23 12:43:16 anudemon-master-00 systemd[1]: kube-apiserver.service: Unit entered failed state. Jul 23 12:43:16 anudemon-master-00 systemd[1]: kube-apiserver.service: Failed with result 'exit-code'. Jul 23 12:43:26 anudemon-master-00 systemd[1]: kube-apiserver.service: Service hold-off time over, scheduling restart. Jul 23 12:43:26 anudemon-master-00 systemd[1]: Stopped Kubernetes API Server. Jul 23 12:43:26 anudemon-master-00 systemd[1]: Started Kubernetes API Server. Jul 23 12:43:26 anudemon-master-00 kube-apiserver[2024]: I0723 12:43:26.756551 2024 server.go:188] Will report 172.16.0.4 as public IP address. Jul 23 12:43:26 anudemon-master-00 kube-apiserver[2024]: F0723 12:43:26.756654 2024 server.go:211] Cloud provider could not be initialized: unknown cloud provider "vagrant" Jul 23 12:43:26 anudemon-master-00 systemd[1]: kube-apiserver.service: Main process exited, code=exited, status=255/n/a Jul 23 12:43:26 anudemon-master-00 systemd[1]: kube-apiserver.service: Unit entered failed state. Jul 23 12:43:26 anudemon-master-00 systemd[1]: kube-apiserver.service: Failed with result 'exit-code'. Jul 23 12:43:36 anudemon-master-00 systemd[1]: kube-apiserver.service: Service hold-off time over, scheduling restart. Jul 23 12:43:36 anudemon-master-00 systemd[1]: Stopped Kubernetes API Server. Jul 23 12:43:36 anudemon-master-00 systemd[1]: Started Kubernetes API Server. Jul 23 12:43:36 anudemon-master-00 kube-apiserver[2039]: I0723 12:43:36.872849 2039 server.go:188] Will report 172.16.0.4 as public IP address. 。我想知道如何用gfortran编译这个程序。

这是主程序:

types.h

这里是头文件" types.h"。

program gauss
implicit none
#include "types.h"

tinteger, parameter :: n=3
treal a(n,n), b(n)

tinteger i, j, k
treal tmp

do i=1,n
   do j=1,n
      A(i,j)=C_PI_R * i+ C_1_5_R * (j-C_1_R) 
   enddo
enddo

do i=1,n
  b(i) = i 
enddo

do j = 1,n-1 
  do i = j+1,n
   a(i,j)     = - a(i,j) / a(j,j)
     do k = j+1,n
       a(i,k) = a(i,k) + a(i,j)*a(j,k)
     enddo
     b(i) = b(i) + a(i,j)*b(j)
   enddo
 enddo

 b(n) = b(n) / a(n,n)  
 do i = n-1,1,-1
   tmp = c_0_r
   do j = i+1,n
     tmp = tmp + a(i,j)*b(j)
   enddo
   b(i) = (b(i)-tmp) / a(i,i)
 enddo

 end program gauss

0 个答案:

没有答案