免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2764 | 回复: 1
打印 上一主题 下一主题

请教一个CLAPACK的程序编译问题。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-05-10 13:51 |只看该作者 |倒序浏览
hi, 我刚装了CLAPACK-3.2.1,但是在编译一个程序的时候出现了很多错误,想请教一下怎么解决。

我把各种静态链接库都放好位置了(/usr/local/lib/),还把头文件也放好位置了(/usr/local/include)。

g++ clapacktest.cc -lcblas -lclapack -llibf2c

/usr/local/lib/libclapack.a(sgetrf.o): In function `sgetrf_':
sgetrf.c:(.text+0x45c): undefined reference to `f2c_strsm'
sgetrf.c:(.text+0x524): undefined reference to `f2c_sgemm'
/usr/local/lib/libclapack.a(sgetrs.o): In function `sgetrs_':
sgetrs.c:(.text+0x194): undefined reference to `f2c_strsm'
sgetrs.c:(.text+0x1cf): undefined reference to `f2c_strsm'
sgetrs.c:(.text+0x303): undefined reference to `f2c_strsm'
sgetrs.c:(.text+0x33e): undefined reference to `f2c_strsm'
/usr/local/lib/libclapack.a(sgetf2.o): In function `sgetf2_':
sgetf2.c:(.text+0x180): undefined reference to `f2c_isamax'
sgetf2.c:(.text+0x1ca): undefined reference to `f2c_sswap'
sgetf2.c:(.text+0x329): undefined reference to `f2c_sger'
sgetf2.c:(.text+0x3b5): undefined reference to `f2c_sscal'
collect2: ld return 1

谢谢。我的程序如下:
#include <iostream>
using namespace std;
extern "C"
{
#include <f2c.h>
#include <clapack.h>
}

int
main (void)
{
  integer M = 3;
  integer N = 1;
  real a[9] = { 4, 3, 11, 2, -1, 0, -1, 2, 3 };
  real b[3] = { 2, 10, 8 };
  integer lda;
  integer ldb;
  integer INFO;
  lda = M;
  ldb = M;
  integer ipiv[M];

  sgesv_ (&M, &N, a, &lda, ipiv, b, &ldb, &INFO);
  if (INFO == 0)
    {
      for (int i = 0; i < M; i++)
        {
          cout << b[i] << endl;
        }
    }
  else
    {
      cout << "Failed." << endl;
    }
  return 0;
}

论坛徽章:
0
2 [报告]
发表于 2011-05-10 15:46 |只看该作者
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP