我知道这个问题已经被回答了无数次,我遵循了每一个建议,但都无济于事。我正在尝试使用VS代码在我的c++代码中设置Eigen,同时在windows上的Ubuntu 20.04上运行命令。我在下面发布了这个特定的帖子:后
这是我的c_cpp_properties.cpp文件:
{
"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
}
根据其他帖子的建议,这是我的任务.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""
}
]
}
仍然得到错误:
Test.cpp:21:9: fatal error: Eigen/Dense: No such file or directory
21 | #include<Eigen/Dense>
| ^~~~~~~~~~~~~
compilation terminated.
我安装了来自:链接的特征
感谢您的帮助。
虽然看起来不太可能,但您可以尝试在#include和<特征值/密集>看看这是否有效?当没有空间时,代码可能不会编译,尽管在您的情况下,编译器确实识别出您试图包含某些内容。值得一试。
帮助我的是使用以下命令行编译程序:g++ -I /path/to/eigen/ my_program.cpp -o my_program
它效率不高,但我相信有办法解决它。