Fortran Coder

查看: 10397|回复: 8

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

[复制链接]

8

帖子

1

主题

0

精华

新人

F 币
25 元
贡献
11 点
发表于 2019-11-4 08:57:50 | 显示全部楼层 |阅读模式
用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.   [ALLOCATE]        F:\SS_Block-V2\SS_Block\Solver\BuiFactorProcess\GPFactorCalc.f90        601        

错误        1         error #6632: Keyword arguments are invalid without an explicit interface.   [STAT]        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        


1958

帖子

12

主题

5

精华

论坛跑堂

臭石头雪球

F 币
1339 元
贡献
565 点

美女勋章热心勋章星光勋章新人勋章贡献勋章管理勋章帅哥勋章爱心勋章规矩勋章元老勋章水王勋章

发表于 2019-11-4 13:29:18 | 显示全部楼层
截个图吧
回复

使用道具 举报

8

帖子

1

主题

0

精华

新人

F 币
25 元
贡献
11 点
 楼主| 发表于 2019-11-5 09:55:06 | 显示全部楼层

编译错误截图

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

8

帖子

1

主题

0

精华

新人

F 币
25 元
贡献
11 点
 楼主| 发表于 2019-11-5 10:14:16 | 显示全部楼层
感觉像是用于程序编译的与关键字相关的资源没有加进来,不懂是不是这个意思,麻烦各位了

8

帖子

1

主题

0

精华

新人

F 币
25 元
贡献
11 点
 楼主| 发表于 2019-11-5 10:45:40 | 显示全部楼层
特别奇怪的是:其他子程序存在allocate分配动态数组内存没有问题, 就这个子程序里面用allocate分配会出现问题

8

帖子

1

主题

0

精华

新人

F 币
25 元
贡献
11 点
 楼主| 发表于 2019-11-5 10:47:36 | 显示全部楼层
       
这是编译过程中的日志BuildLog.htm文件内信息:

Compiling with Intel(R) Visual Fortran Compiler XE 15.0.0.108 [IA-32]...
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.   [STAT]
        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]
        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)

8

帖子

1

主题

0

精华

新人

F 币
25 元
贡献
11 点
 楼主| 发表于 2019-11-5 10:52:31 | 显示全部楼层
更奇怪的是出现问题的子程序中:出现allocate问题的前部分代码也有动态数组allocate的代码,但内存分配和释放都没问题,轮到这部分代码了就丫的有问题了

8

帖子

1

主题

0

精华

新人

F 币
25 元
贡献
11 点
 楼主| 发表于 2019-11-5 10:54:39 | 显示全部楼层
我尝试了新建一个项目,把子程序按流程一个个的加进来,在出现问题的子程序加进来之前都能编译与运行,但加了这个子程序就出现问题。之前加载的子程序也有allocate,但没出现问题

8

帖子

1

主题

0

精华

新人

F 币
25 元
贡献
11 点
 楼主| 发表于 2019-11-5 11:11:01 | 显示全部楼层
麻蛋,找出问题了,是前面的一行代码的末尾多写了一个“&”,哎,我也是够了
您需要登录后才可以回帖 登录 | 极速注册

本版积分规则

捐赠本站|Archiver|关于我们 About Us|小黑屋|Fcode ( 京ICP备18005632-2号 )

GMT+8, 2024-4-19 09:01

Powered by Tencent X3.4

© 2013-2024 Tencent

快速回复 返回顶部 返回列表