Fortran Coder

查看: 3487|回复: 4
打印 上一主题 下一主题

[子程序] 程序运行后undefined reference to `al_'出错

[复制链接]

50

帖子

24

主题

0

精华

大师

F 币
1148 元
贡献
475 点
跳转到指定楼层
楼主
发表于 2021-12-10 22:57:29 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
程序运行后出错:
/usr/bin/ld: /tmp/ccz6HngJ.o: in function `MAIN__':
main.f95:(.text+0x244): undefined reference to `al_'
collect2: error: ld returned 1 exit status

         如何排出?!盼复! 谢谢
分享到:  微信微信
收藏收藏 点赞点赞 点踩点踩

15

帖子

6

主题

0

精华

熟手

F 币
170 元
贡献
72 点
沙发
发表于 2021-12-10 23:15:44 | 只看该作者
贴程序。不然谁知道啥问题。

50

帖子

24

主题

0

精华

大师

F 币
1148 元
贡献
475 点
板凳
 楼主| 发表于 2021-12-11 07:50:19 | 只看该作者
收到,谢谢!回复如下:
附部分程序,足够了解问题所在吗?
[Fortran] 纯文本查看 复制代码
Dimension a(100), a1(101), c(101), d(2), q(98)
  Write (*, 3)
  Read (*, *) n
  np1 = n + 1
  Write (*, 5)
  Do i = 1, np1
    Read (*, *) a1(i)
  End Do
  Do i = 1, n
    a(i) = a1(i+1)/al(1)
  End Do
。。。。。。。
  3 Format (1X, 'Enter the order of the polynomial')
  5 Format (1X, 'Enter the coefficients of the polynomial starting',&
  ' from the highest order'/5X, ' and press Enter key after ', &
  'entering each number.')
  10 Format (1X, 'Enter the initial guesses of d(l) and d(2)', &
  'and Epsilon, e.g.,.005,.005,.00001:')
  11 Format (1X, 'The Roots are :'//'REAL PART   IMAGINARY', &
  'PART    ITERATIONS')
  170 Format (F17.5, F18.5, 7X, I7)
  298 Format (/5X, 'Denominator is zero.!')
  352 Format (/5X, 'The process is not converging!')
  368 Format (/5X, 'The process is slow in converging!')
  382 Format (/5X, 'Iteration is terminated after 200 trials.')
390 End Program

**********************上面是程序的开始和结束部分,
输入:Standard Input:  
3
1
2
3
4
***********
输出:
Compilation failed due to following error(s)./usr/bin/ld: /tmp/ccHVF472.o: in function `MAIN__':
main.f95:(.text+0x244): undefined reference to `al_'
collect2: error: ld returned 1 exit status
         
     

50

帖子

24

主题

0

精华

大师

F 币
1148 元
贡献
475 点
地板
 楼主| 发表于 2021-12-11 09:52:04 | 只看该作者
啊, 我自己也认真地看了一下, 确实纠错问题1: Al=A1,(要看清楚 l 和 1 的差别, 容易混淆)。问题2: 程序要求输入, 一定按程序编制的要求, 这里:Input:
5
1
2
3
4
6
9
0.005,0.005,0.00001
输出结果为,Output:
$gfortran -std=f95 *.f95 -o main
$main
Enter the order of the polynomial
Enter the coefficients of the polynomial starting from the highest order
      and press Enter key after entering each number.
Enter the initial guesses of d(l) and d(2)and Epsilon, e.g.,.005,.005,.00001:
The Roots are :
REAL PART   IMAGINARYPART    ITERATIONS
          0.68234           1.29869            18
          0.68234          -1.29869            18
         -0.88316           1.35512             7
         -0.88316          -1.35512             7
         -1.59836           0.00000             1
****************
该程序为算法, Bairstow方法求多项式的所有根(包括实数和复数)
     问题解决
谢谢  

1958

帖子

12

主题

5

精华

论坛跑堂

臭石头雪球

F 币
1339 元
贡献
565 点

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

5#
发表于 2021-12-13 08:29:11 | 只看该作者
implicit none 是如此重要
您需要登录后才可以回帖 登录 | 极速注册

本版积分规则

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

GMT+8, 2024-4-20 03:48

Powered by Tencent X3.4

© 2013-2024 Tencent

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