skip to Main Content

I know this question been answered like a million time, and I have followed with each suggestion to no avail. I am trying to set up Eigen in my c++ code using VS code while running commands on Ubuntu 20.04 on windows. I was following with this specific post:
Post

This is my c_cpp_properties.cpp file:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "C:/cygwin64/usr/include/**",
                "C:/Program Files/LLVM/bin/**",
                "C:/Users/J/Documents/eigen-3.4.0/eigen-3.4.0",
                "C:/Users/J/Documents/eigen-3.4.0/eigen-3.4.0/Eigen/**",
                "C:/Users/J/Documents/eigen-3.4.0/eigen-3.4.0/Eigen/src/**",
                "C:/Users/J/Documents/eigen-3.4.0/eigen-3.4.0/test",
                "C:/Users/J/Documents/eigen-3.4.0/eigen-3.4.0/test/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.18362.0",
            "compilerPath":  ""C:/Program Files/LLVM/bin/clang++.exe"",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64"
        }
    ],
    "version": 4
}

And following the suggestion from other posts, this is my tasks.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe build active file",
            "command": "C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\g++.exe",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\${fileBasenameNoExtension}.exe",
                "-I",
                "C:\Users\J\Documents\eigen-3.4.0\eigen-3.4.0\Eigen\",
                
            ],
            "options": {
                "cwd": "C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "compiler: "C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\g++.exe""
        }
    ]
}

Still getting the error:

Test.cpp:21:9: fatal error: Eigen/Dense: No such file or directory
   21 | #include<Eigen/Dense>
      |         ^~~~~~~~~~~~~
compilation terminated.

I installed Eigen from: LINK

Any help is appreciated, thanks.

2

Answers


  1. Chosen as BEST ANSWER

    what helped me is compiling my program with the following command line: g++ -I /path/to/eigen/ my_program.cpp -o my_program

    It's not efficient but there is a way around it I believe.


  2. Although it seems unlikely, can you try adding a space between #include and <Eigen/Dense> and see if that works? The code probably doesn’t compile when there’s no space there, although in your case the compiler does recognise that you are trying to include something. Worth a shot.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search