'How do you install Eigen?

I'm a complete beginner at Eigen, including headers and coding in general. I tried installing Eigen's libraries to do some stuff in Visual Studio Code but I can't find the solution, or rather I don't understand what the answers mean. I have downloaded the zip from the site but don't know what to do with it. My main question is, should you not be able to see the definition to #include <eigen3/Eigen/Dense> in vscode? Because I can't and I don't understand if I'm supposed to.

I hear many of the answers say "Eigen c++ is a header only library: you don't have to install it, you just download it, unzip it and link your code against it." so does that mean i need to place the Eigen/Dense files in the default include? Because when I do I can't find them when I right click on /Dense> in the include code. Do I include them in my environment variables?



Solution 1:[1]

You need to add the directory to which you copied Eigen to the include path of your project. After this #include<Eigen/Dense> should work. Please google "visual C++ add directory to include path" to see how this is done.

Solution 2:[2]

1. Download Eigen

$ wget -O Eigen.zip https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.zip

2. Extract and copy to /usr/local/include

$ unzip Eigen.zip # it has unzipped into the library called eigen-3.4.0
$ sudo cp -r eigen-3.4.0/Eigen /usr/local/include 

Now you can compile your source files

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 dnet
Solution 2 Levon Minasian