'#include errors detected for eigen library

I have been trying to use the Eigen library for c++ in VS code. I have seen various answers explaining how to solve the problem. I have opened the c_cpp_properties.json. I have my Eigen library : enter image description here

But my MinGW shows different files from what I have seen in other answers and tutorials.

enter image description here

Error in code: enter image description here

After this, what should I do? I tried adding the include path, but I cannot solve this. Any help is highly appreciated.



Solution 1:[1]

You can move the whole Eigen Library to an included folder in IncludePath.

This is an example:

settings.json

"C_Cpp.default.includePath": [
        "${workspaceFolder}/**",
        "C:\\TDM-GCC-64\\include",
        "C:\\TDM-GCC-64\\lib\\gcc\\x86_64-w64-mingw32\\10.3.0\\include",
        "C:\\TDM-GCC-64\\lib\\gcc\\x86_64-w64-mingw32\\10.3.0\\include\\c++"
    ]

For you:

"configurations": [
         {
             "name": "Win32",
             "includePath": [
                 "${workspaceFolder}/**",
                 "C:\\MinGW\\include",
                 "C:\\MinGW\\lib\\gcc\\x86_64-w64-mingw32\\{Your GCC Version}\\include",
                 "C:\\MinGW\\lib\\gcc\\x86_64-w64-mingw32\\{Your GCC Version}\\include\\c++"
             ]
         }
]

You can put it in any of the folders like this.

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