铁人6 发表于 2019-11-4 08:57:50

用IVF分配动态数组提示“allocate”关键字需要定义

用real,allocateble::定义了一个实型动态数组,在内存分配是提示“allocate”关键字需要定义,之前没出现过这个问题。是编译器的问题吗,少了什么组件?

请了解的人帮帮忙,谢谢。

代码中:
1)数组定义:
      real,allocatable    ::tempMaterialExposureBdUpFactorByDifferentMfp(:,:)
2)内存分配:
      !分配内存
      allocate(tempMaterialExposureBdUpFactorByDifferentMfp(buildUpFactorMaterialNum,buildUpFactorMaterialNum),stat = status)
      if(status /= 0)then
            print*,"变量内存分配错误“
      endif
      tempMaterialExposureBdUpFactorByDifferentMfp = 0

3)编译错误信息:
错误      2         error #6404: This name does not have a type, and must have an explicit type.         F:\SS_Block-V2\SS_Block\Solver\BuiFactorProcess\GPFactorCalc.f90      601      

错误      1         error #6632: Keyword arguments are invalid without an explicit interface.         F:\SS_Block-V2\SS_Block\Solver\BuiFactorProcess\GPFactorCalc.f90      601      

错误      3      Compilation Aborted (code 1)      F:\SS_Block-V2\SS_Block\Solver\BuiFactorProcess\GPFactorCalc.f90      1      


fcode 发表于 2019-11-4 13:29:18

截个图吧

铁人6 发表于 2019-11-5 09:55:06

编译错误截图

C:\Users\Administrator\Desktop\1.jgp

铁人6 发表于 2019-11-5 10:14:16

感觉像是用于程序编译的与关键字相关的资源没有加进来,不懂是不是这个意思,麻烦各位了

铁人6 发表于 2019-11-5 10:45:40

特别奇怪的是:其他子程序存在allocate分配动态数组内存没有问题, 就这个子程序里面用allocate分配会出现问题

铁人6 发表于 2019-11-5 10:47:36

       
这是编译过程中的日志BuildLog.htm文件内信息:

Compiling with Intel(R) Visual Fortran Compiler XE 15.0.0.108 ...
ifort /nologo /debug:full /Od /warn:interfaces /module:"Debug\\" /object:"Debug\\" /Fd"Debug\vc120.pdb" /traceback /check:bounds /check:stack /libs:dll /threads /dbglibs /c /Qvc12 /Qlocation,link,"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\\bin" "C:\Users\Administrator\Desktop\PKI\PKI\Solver\BuildUpFactorProcess\GPFactorCalc.f90"
C:\Users\Administrator\Desktop\PKI\PKI\Solver\BuildUpFactorProcess\GPFactorCalc.f90(596): error #6632: Keyword arguments are invalid without an explicit interface.   
      allocate(tempMaterialExposureBdUpFactorByDifferentMfp(buildUpFactorMaterialNum,buildUpFactorMaterialNum),stat = status)
-----------------------------------------------------------------------------------------------------------------^
C:\Users\Administrator\Desktop\PKI\PKI\Solver\BuildUpFactorProcess\GPFactorCalc.f90(596): error #6404: This name does not have a type, and must have an explicit type.   
      allocate(tempMaterialExposureBdUpFactorByDifferentMfp(buildUpFactorMaterialNum,buildUpFactorMaterialNum),stat = status)
--------^
compilation aborted for C:\Users\Administrator\Desktop\PKI\PKI\Solver\BuildUpFactorProcess\GPFactorCalc.f90 (code 1)


PKI - 3 error(s), 0 warning(s)

铁人6 发表于 2019-11-5 10:52:31

更奇怪的是出现问题的子程序中:出现allocate问题的前部分代码也有动态数组allocate的代码,但内存分配和释放都没问题,轮到这部分代码了就丫的有问题了

铁人6 发表于 2019-11-5 10:54:39

我尝试了新建一个项目,把子程序按流程一个个的加进来,在出现问题的子程序加进来之前都能编译与运行,但加了这个子程序就出现问题。之前加载的子程序也有allocate,但没出现问题

铁人6 发表于 2019-11-5 11:11:01

麻蛋,找出问题了,是前面的一行代码的末尾多写了一个“&”,哎,我也是够了
页: [1]
查看完整版本: 用IVF分配动态数组提示“allocate”关键字需要定义