包含现有 header 时出现致命错误

Fatal error on include of existing header

当我尝试使用 Fastor-Library(https://github.com/romeric/Fastor) 并包含该库时,出现错误,即 repo 中的文件夹不存在。这是我的错误,还是我应该向 Fastor 的作者提出问题?

代码:

#include "Fastor/Fastor.h"

int main(){
    Fastor::Tensor<double,2> A;
    return 0;
}

文件夹结构:

total 8
drwxr-xr-x 15 name name 4096 Feb 13 13:19 Fastor
-rw-r--r--  1 name name   82 Feb 13 13:20 main.cpp

为什么会出现以下错误?

g++ -std=c++14 -O3 -mavx -DNDEBUG main.cpp -o main
In file included from Fastor/simd_vector/SIMDVector.h:4:0,
                 from Fastor/Fastor.h:6,
                 from main.cpp:1:
Fastor/simd_vector/simd_vector_base.h:4:10: fatal error: commons/commons.h: No such file or directory
 #include "commons/commons.h"
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.

你能重现错误吗,还是我做错了什么?

你的编译命令应该是:

g++ -std=c++14 -O3 -mavx -DNDEBUG main.cpp -o main -I Fastor

你应该只包含 "Fastor.h" 而不是 "Fastor/Fastor.h"