C++ 无法从不同的Internet文件夹添加CodeQL库:“0”;无法解析模块<;xxx>&引用;

C++ 无法从不同的Internet文件夹添加CodeQL库:“0”;无法解析模块<;xxx>&引用;,c++,codeql,semmle-ql,C++,Codeql,Semmle Ql,我有以下文件夹结构: └── MyProj ├── Dangerous_Memcopy │ ├── Config.qll │ └── ... ├── MemMangementLibraries │ ├── FFmpegMemory │ └── ... 这是Config.qll的开头: import cpp import Utils // Change here the memory library if wrappers exis

我有以下文件夹结构:

└── MyProj
    ├── Dangerous_Memcopy
    │   ├── Config.qll
    │   └── ...
    ├── MemMangementLibraries
    │   ├── FFmpegMemory
    │   └── ...
这是
Config.qll
的开头:

import cpp
import Utils
// Change here the memory library if wrappers exists in project
import MemMangementLibraries.FFmpegMemory
import semmle.code.cpp.dataflow.TaintTracking



class MyConfig extends TaintTracking::Configuration{
    MyConfig() {this = "MyConfig"}

    override predicate isSource(DataFlow::Node node){
        exists(
            CallAllocationExpr alloc_foo | 
            (
                node.asExpr() = alloc_foo
                and not alloc_foo.getFile().toString().matches("%mem.c%")
            )
        )
    }

...

我在四行有一个错误:
import memmanagementlibraries.FFmpegMemory

无法解析模块MemMangementLibraries.FFmpegMemory

我不明白为什么。我使用库名称后的文件夹名称进行了导入:

import MemMangementLibraries.FFmpegMemory
知道问题出在哪里吗?
如果我将库
FFmpegMemory.qll
移动到文件夹
下,并将
Config.qll
中的第四行更改为
import FFmpegMemory
,它将接受它


它似乎无法识别导入中使用的文件夹
MemMangementLibraries

在QL中导入是相对于“QL包根”解析的,后者是包含文件的最近封闭目录。(它们也会相对于包含
import
语句的文件进行解析,这就是为什么如果将库移到导入文件旁边,这种方法会起作用。)

在这种情况下,您的
MyProj
目录是否不包含
qlpack.yml
?如果它本身在一个QL包中(也就是说,它的父级包含一个
qlpack.yml
),那么您应该能够将它作为
MyProj导入。MemMangementLibraries.FFmpegMemory
。或者,您可以在其中添加一个最小的
qlpack.yml
,以使导入工作正常