This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Example compilation error

Tags: None
(comma "," separated)
aferran
Registered Member
Posts
2
Karma
0

Example compilation error

Wed Jul 24, 2019 11:17 am
Hi there,

I need to iterate through a 2D array, so I tried the example showed here:
https://eigen.tuxfamily.org/dox-devel/g ... alSTL.html

Code: Select all
#include <iostream>
#include <Eigen/Core>

int main()
{
   Eigen::ArrayXXi A = Eigen::ArrayXXi::Random(4,4).abs();
   std::cout << "Here is the initial matrix A:\n" << A << "\n";
   for(auto row : A.rowwise())
      std::sort(row.begin(), row.end());
   std::cout << "Here is the sorted matrix A:\n" << A << "\n";
}


But it doesn't compile (tried with gcc 7.4.0 and 8.3.0). I got the following error:

array.cpp: In function ‘int main()’:
array.cpp:9:27: error: ‘begin’ was not declared in this scope
for(auto row : A.rowwise())

Any ideas how to solve this? I couldn't find anything online.

Thanks,

Antoine
aferran
Registered Member
Posts
2
Karma
0

Re: Example compilation error  Topic is solved

Wed Jul 24, 2019 12:23 pm
Figured it out!
I didn't realize that this example is only valid for Eigen 3.4 which is not available yet.
I tried using the latest version on git and it worked.

Antoine


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell