EigenChineseDocument icon indicating copy to clipboard operation
EigenChineseDocument copied to clipboard

编译错误问题

Open Jas0nG opened this issue 1 year ago • 1 comments

Subject

编译时存在未声明的变量,错误信息如下:

In file included from /home/wtc/Project/EigenChineseDocument/Eigen/chapter3_test.cpp:1:
~/Project/EigenChineseDocument/Eigen/Chapter3_SparseLinearAlgebra/Section1_SparseMatrixManipulations.hpp: In function ‘void Chapter3_SparseLinearAlgebra::Section1_SparseMatrixManipulations::TheSparseMatrixClass()’:
~Project/EigenChineseDocument/Eigen/Chapter3_SparseLinearAlgebra/Section1_SparseMatrixManipulations.hpp:133:42: error: ‘rows’ was not declared in this scope
  133 |                 SparseMatrix<double> mat(rows, cols);
      |                                          ^~~~
~/Project/EigenChineseDocument/Eigen/Chapter3_SparseLinearAlgebra/Section1_SparseMatrixManipulations.hpp:133:48: error: ‘cols’ was not declared in this scope; did you mean ‘cosl’?
  133 |                 SparseMatrix<double> mat(rows, cols);
      |                                                ^~~~
      |                                                cosl
make[2]: *** [CMakeFiles/chapter3_test.dir/build.make:76: CMakeFiles/chapter3_test.dir/chapter3_test.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:113: CMakeFiles/chapter3_test.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

看起来是文档中的伪代码部分被错误地复制为了可运行的代码部分。我稍后会提一个PR解决这个问题。

我的环境

  • Ubuntu 20.04
  • Eigen 3.3.7

Jas0nG avatar Aug 15 '23 08:08 Jas0nG

麻烦在PR合入后关闭该Issue #3

Jas0nG avatar Aug 15 '23 08:08 Jas0nG