I have installed libeigen3-dev in order to compile programs using Eigen 3. when I include a file, such as Eigen/Dense I get this error when I try t
Run your compiler with the --verbose switch:
g++ --verbose ...
If your includes are relative to one of the paths shown in this output, you don't have to use -I. It depends how gcc has been configured, and it depends where that other stuff is installed.
Note that . is typically not in the -I paths.
Later
After exchanging a couple of comments it is clear that /usr/include/eigen3/Eigen/Dense should be include-able by #include , but not by #include . Therefore, the addition of the command line option -I /usr/include/eigen3 is mandatory.
Whether some installation selects to install header files into a directory that in one of the ones compiled into gcc, depends on the default, a decision made by the distributor, or a decision made during installation. I'd say that "frequently used" header files (Boost) are well placed into /usr/local/include while some "elitist" stuff would be better off in a directory of its own.