我想在我的項目中使用Eigen3,當我嘗試使用CMake的構建,使Eigen3從Linux Mint的17.3回購,稀疏矩陣未命名
/usr/include/eigen3/unsupported/Eigen/src/KroneckerProduct/KroneckerTensorProduct.h:246:11: error: ‘SparseMatrix’ does not name a type
typedef SparseMatrix<Scalar, 0, StorageIndex> ReturnType;
我使用Linux Mint的17.3我得到這個錯誤。我有eigen2和eigen3庫,我很確定CMake正在挑選eigen3(尤其是考慮到我在上面發佈的錯誤消息)。我使用命令 sudo apt-get install libeigen3-dev
安裝了eigen3。 當我運行apt-cache show libeigen3-dev
我得到
Package: libeigen3-dev
Priority: extra
Section: universe/libdevel
Installed-Size: 5130
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Debian Science Maintainers <[email protected]>
Architecture: all
Source: eigen3
Version: 3.3~beta1-2
Depends: pkg-config
Suggests: libeigen3-doc, libmrpt-dev
Filename: pool/universe/e/eigen3/libeigen3-dev_3.3~beta1-2_all.deb
Size: 662650
MD5sum: bad08ef7b1d166c5bc9903e510a9fb68
SHA1: ef35745fcd047f1a1f18834e02ccef1476d7407c
SHA256: 5c73d97dca2d950ce51bde451deed4b6508b2f6cca9b9b6563218591e029f17b
Description-en: lightweight C++ template library for linear algebra
Eigen 3 is a lightweight C++ template library for vector and matrix math,
a.k.a. linear algebra.
.
Unlike most other linear algebra libraries, Eigen 3 focuses on the simple
mathematical needs of applications: games and other OpenGL apps, spreadsheets
and other office apps, etc. Eigen 3 is dedicated to providing optimal speed
with GCC. A lot of improvements since 2-nd version of Eigen.
Description-md5: 71025bd67be9e83075fd5a0e7ab822a2
Homepage: http://eigen.tuxfamily.org
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Supported: 9m
這裏有一個最小的代碼片段:
#include <unsupported/Eigen/KroneckerProduct>
int main() {
return 0;
}
與g++ -std=c++11 -I /usr/local/include/eigen3 hello.cpp -o hello
編譯:
In file included from /usr/local/include/eigen3/unsupported/Eigen/KroneckerProduct:30:0,
from hello.cpp:4:
/usr/local/include/eigen3/unsupported/Eigen/src/KroneckerProduct/KroneckerTensorProduct.h:246:11: error: ‘SparseMatrix’ does not name a type
typedef SparseMatrix<Scalar, 0, StorageIndex> ReturnType;
官方版本怎麼樣? – kangshiyin
我測試了mercurial repo的官方版本,並且得到了同樣的錯誤。 – BlazePascal
舊版本如3.2.9如何?無論如何,它是'不支持的' – kangshiyin