Eigen installation "Eigen/Dense' file not found"

Viewed 312

I tried to use eigen in mac. After I installing it I run a demo from its' main page in Xcode.The code is as follows:

#include <iostream>
#include <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;
}

But it shows "Eigen/Dense' file not found". I try the ways as followed:

  1. Change include line to:#include <Eigen/Core>

  2. try to place the "Eigen" into the "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/" which includes header file like .

3.use the command line"g++ -I /usr/local/include/eigen3 aaa.cpp -o aaa -O1 ". The third one is from

fatal error: 'eigen3/Eigen/Dense' file not found

But I don't know why use this command line. Can someone tell me why? What's more, It also doesn't work for me. Some people said "/usr/local/include" is the default folders, but there is no "/usr/local/include" in my Mac. So I make a file folder named "include" in 'usr/local'and put the Eigen into it. But it doesn't work. I can't run this code in Xcode. Can someone help me to solve this problem? Thanks!

0 Answers
Related