I tried to use eigen in mac. After I installing it I run a demo from its' main page.The code is as follows:
#include <iostream>
#include <eigen3/Eigen/Dense>
using Eigen::MatrixXd;
int main()
{
MatrixXd m(2,2);
m(0,0) = 3;
m(1,0) = 2.5;
m(0,1) = -1;
m(1,1) = m(1,0) + m(0,1);
std::cout << m << std::endl;
}
And I write following code in terminal:
g++ -I usr/local/include/eigen3/Eigen/ aaa.cpp -o aaa
It turns out like that:
aaa.cpp:2:10: fatal error: 'eigen3/Eigen/Dense' file not found
However I can run this code perfectly in Xcode. Who can help me to fix it?
Change your include line to
#include <Eigen/Dense>
or
#include <Eigen/Core>
and your command line to
g++ -I /usr/local/include/eigen3 aaa.cpp -o aaa
I recommend also adding at least -O1 to your command line, as soon as you compile any code with more than a few instructions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With