Fortran 模块版本致命错误

发布于 2024-11-02 12:51:31 字数 1714 浏览 0 评论 0原文

我在 Fortran 95 上遇到了一个非常可怕的错误:

Fatal Error: While reading module 'list5.mod' found module version 0, expected 6

我已经包含了模块的主要结构。我非常怀疑它与我的模块内的内容有任何关系,因为它给了我关于这些的错误消息,并且我已经能够修复它们,这意味着它能够很好地通过我的模块,这只是与我使用该模块的方式。也许?

    MODULE list5
    IMPLICIT NONE

    CONTAINS

----

END MODULE

主程序的结构如下:

    PROGRAM mainlist
    USE list5
IMPLICIT NONE

    !Variable Declaration
    INTEGER:: opt
    INTEGER, PARAMETER:: maxitems=50
    INTEGER:: size=0
    CHARACTER(20):: itemarray(50)
    INTEGER:: quantityarray(50)
    INTEGER:: totalquantity, i=0
    REAL:: totalprice=0, pricearray(50)=0

    CHARACTER(20), DIMENSION(:)::Item
    CHARACTER(20):: ItemSought
    LOGICAL:: Found
    INTEGER:: Location

    INTEGER:: NumItems=0, SmallestItem=0

!Select statement for the menu

DO
opt=choices()
SELECT CASE (opt)
    CASE(1)
        size=size+1
        CALL getItemData(itemarray,pricearray,quantityarray)
    CASE(2)
        CALL getFileItems(size,itemarray,pricearray,quantityarray)
    CASE(3)
        CALL pickItemRandomly (size)
    CASE(4)
        CALL calcListTotals
(pricearray,quantityarray,totalprice,totalquantity)
        CALL printList(size,itemarray,pricearray,quantityarray,totalprice, totalquantity)
    CASE(5)
        CALL sortByItem(itemarray, pricearray, quantityarray)
    CASE(6)
        CALL sortByPrice(itemarray, pricearray, quantityarray)
    CASE(7)
        CALL writeListtoFile(size,itemarray, pricearray, quantityarray)

    CASE(8)
        CALL search(itemarray, ItemSought, Found, Location)
    CASE(9)
        STOP
END SELECT
END DO



END PROGRAM

有什么建议吗?我真的需要解决这个问题,所以任何帮助将不胜感激。非常感谢!!

I have a very scary error on Fortran 95:

Fatal Error: While reading module 'list5.mod' found module version 0, expected 6

I have included the main structure of my module. I highly doubt it has anything to do with the substance inside my module since it has given me error messages on those and I have been able to fix them which means it is able to go through my module fine it is just something small related to the way I use the module. Perhaps?

    MODULE list5
    IMPLICIT NONE

    CONTAINS

----

END MODULE

The main program is structured something like this:

    PROGRAM mainlist
    USE list5
IMPLICIT NONE

    !Variable Declaration
    INTEGER:: opt
    INTEGER, PARAMETER:: maxitems=50
    INTEGER:: size=0
    CHARACTER(20):: itemarray(50)
    INTEGER:: quantityarray(50)
    INTEGER:: totalquantity, i=0
    REAL:: totalprice=0, pricearray(50)=0

    CHARACTER(20), DIMENSION(:)::Item
    CHARACTER(20):: ItemSought
    LOGICAL:: Found
    INTEGER:: Location

    INTEGER:: NumItems=0, SmallestItem=0

!Select statement for the menu

DO
opt=choices()
SELECT CASE (opt)
    CASE(1)
        size=size+1
        CALL getItemData(itemarray,pricearray,quantityarray)
    CASE(2)
        CALL getFileItems(size,itemarray,pricearray,quantityarray)
    CASE(3)
        CALL pickItemRandomly (size)
    CASE(4)
        CALL calcListTotals
(pricearray,quantityarray,totalprice,totalquantity)
        CALL printList(size,itemarray,pricearray,quantityarray,totalprice, totalquantity)
    CASE(5)
        CALL sortByItem(itemarray, pricearray, quantityarray)
    CASE(6)
        CALL sortByPrice(itemarray, pricearray, quantityarray)
    CASE(7)
        CALL writeListtoFile(size,itemarray, pricearray, quantityarray)

    CASE(8)
        CALL search(itemarray, ItemSought, Found, Location)
    CASE(9)
        STOP
END SELECT
END DO



END PROGRAM

Any suggestions at all?? I really need to solve this so any help would be appreciated. Thanks so much!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

差↓一点笑了 2024-11-09 12:51:31

正如 Rook 所说,问题在于编译器版本;不知何故,第一次编译 list5 时的 .mod 文件是由较旧的编译器生成的。清除所有 .o 和 .mod 文件,然后重试,首先编译 list5.f90 (或包含模块 list5 的任何文件),然后编译主程序。

As Rook says, the issue is with compiler versions; somehow the .mod file from by compiling list5 the first time around was generated by an older compiler. Clear out all your .o and .mod files, and try again, first compiling list5.f90 (or whatever the file containing module list5 is) and then compiling the main program.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文