我知道這個問題已經被回答了一百萬次,但我遵循了每一個建議都無濟于事。我正在嘗試使用 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
}
根據其他帖子的建議,這是我的 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\""
}
]
}
仍然收到錯誤:
Test.cpp:21:9: fatal error: Eigen/Dense: No such file or directory
21 | #include<Eigen/Dense>
| ^~~~~~~~~~~~~
compilation terminated.
我從以下位置安裝了 Eigen:LINK
任何幫助表示贊賞,謝謝。
uj5u.com熱心網友回復:
雖然看起來不太可能,但您可以嘗試在 #include 和 <Eigen/Dense> 之間添加一個空格,看看是否可行?當那里沒有空間時,代碼可能無法編譯,盡管在您的情況下,編譯器確實認識到您正在嘗試包含某些內容。值得一試。
uj5u.com熱心網友回復:
幫助我的是使用以下命令列編譯我的程式:
g -I /path/to/eigen/ my_program.cpp -o my_program
它效率不高,但我相信有辦法解決它。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/495880.html
