Hash 如何使用谷歌&x27;s稀疏散列

Hash 如何使用谷歌&x27;s稀疏散列,hash,sparse-matrix,Hash,Sparse Matrix,在我的项目中,我被要求使用谷歌的稀疏散列。但我甚至不知道从哪里开始。以下是我所采取的步骤,甚至没有编译我的代码: sparsehash-1.11代码与我的代码位于同一目录中 我在代码开头键入了“#include” 错误是 Multiple markers at this line - fatal error: google/sparse_hash_map: No such file or directory - Unresolved inclusion: <google/sparse_

在我的项目中,我被要求使用谷歌的稀疏散列。但我甚至不知道从哪里开始。以下是我所采取的步骤,甚至没有编译我的代码:

  • sparsehash-1.11代码与我的代码位于同一目录中
  • 我在代码开头键入了“#include”
错误是

Multiple markers at this line
- fatal error: google/sparse_hash_map: No such file or directory
- Unresolved inclusion: <google/sparse_hash_map>
此行有多个标记
-致命错误:google/sparse\u hash\u映射:没有这样的文件或目录
-未解决的包括:

我真的不知道该怎么办。等待您的帮助。

如果这是显而易见的,很抱歉,但是如果您的google hashmap源代码已经与您的代码位于同一目录中,您可能应该尝试:

#include "sparse_hash_map"
而不是

#include <google/sparse_hash_map>
#包括
更糟糕的情况是,
在编译命令行中包含-I
。 祝你好运

您可以在计算机中定位稀疏散列集(定位稀疏散列集),并从安装稀疏散列集的目录创建一个符号链接到谷歌/稀疏散列图

test@ubuntu:~# updatedb                   # To update the locate database
test@ubuntu:~# locate sparse_hash_map
/usr/include/google/sparsehash/sparse_hash_map
test@ubuntu:~# ln -s /usr/include/google/sparsehash/sparse_hash_map /usr/include/google/sparse_hash_map