使用Eigen不支持的Arpack支持模块生成错误

时间:2020-01-23 14:37:53

标签: c++ eigen arpack

main.cc中的代码是:

#include <Eigen/Sparse>
#include <unsupported/Eigen/ArpackSupport>

int main()
{
    ...
    Eigen::ArpackGeneralizedSelfAdjointEigenSolver<Eigen::SparseMatrix<double>> solver;
    solver.compute(...);
    ...
}

以下命令

c++ -I /path/to/eigen -std=c++17 main.cc

导致以下错误:

Undefined symbols for architecture x86_64:
  "_dsaupd_", referenced from:
      Eigen::internal::arpack_wrapper<double, double>::saupd(int*, char*, int*, char*, int*, double*, double*, int*, double*, int*, int*, int*, double*, double*, int*, int*) in arpack-946df6.o
  "_dseupd_", referenced from:
      Eigen::internal::arpack_wrapper<double, double>::seupd(int*, char*, int*, double*, double*, int*, double*, char*, int*, char*, int*, double*, double*, int*, double*, int*, int*, int*, double*, double*, int*, int*) in arpack-946df6.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

问题出在哪里,如何解决?

0 个答案:

没有答案