user949358
user949358

Reputation: 113

Code will not compile using Eigen library syntax issue perhaps?

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

When I compile I get this error test.cpp:2:23: error: Eigen/Dense: No such file or directory

However Eigen/Dense does exist my cpp file is in the directory in which /Eigen is in. Can anyone help?

Upvotes: 0

Views: 2698

Answers (1)

hmjd
hmjd

Reputation: 122011

Changing from:

g++ -I / test.cpp

#include <Eigen/Dense>

to:

g++ -I . test.cpp

#include "Eigen/Dense"

corrected this.

Upvotes: 3

Related Questions