简体   繁体   English

f2py包装器编译错误:设置数组的形状

[英]f2py wrapper compilation error: setting shape of array

I'm having a problem with compiling via f2py. 我在通过f2py进行编译时遇到问题。 I have an f90 module with several subroutines in it. 我有一个带有几个子例程的f90模块。 It has been compiling fine up to this point for use in a python script. 到目前为止,它一直可以进行编译以供在python脚本中使用。 However, now when I try to compile it and build it, it complains with this error: 但是,现在,当我尝试编译并构建它时,它抱怨此错误:

build/src.macosx-10.5-x86_64-2.7/PyCosmology/sims/fort/read_sim-f2pywrappers2.f90:355.17:

   allocate(d())
             1
Error: Shape specification for allocatable scalar at (1)

It also has two other errors, but these just result from d() not being allocated correctly here. 它还有另外两个错误,但是这些错误仅是由于d()在此处未正确分配引起的。 You can see that the file it is compiling is the f2py wrapper. 你可以看到,它是编译的文件是f2py包装。 More strangely, when I actually look at the wrapper file that it points to, line 355 is in fact: 更奇怪的是,当我实际查看它指向的包装文件时,实际上是第355行:

       allocate(d(s(1),s(2)))

so I have no idea why the compiler is telling me there are no shape specifiers in the allocate statement. 所以我不知道为什么编译器告诉我在allocate语句中没有形状说明符。 And because of that, I have no idea how to fix it! 因此,我不知道如何解决它!

Note that I have changed the module a little since last it compiled correctly, but the array for which this error occurs I have not touched at all, neither have I touched the particular subroutine it exists in. 请注意,自上一次模块正确编译以来,我对其进行了一些更改,但是我完全没有碰到发生此错误的数组,也没有碰到它所在的特定子例程。

Figured it out. 弄清楚了。

I was trying to allocate to an integer. 我试图分配给一个整数。 Sorry. 抱歉。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM