提问者:小点点

编译器上的策略数据结构不工作


我想使用基于策略的数据结构,但我的编译器一直给我错误。

下面是我在代码中使用的内容:

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

以下是我收到的错误消息:

fatal error: 
      'ext/typelist.h' file not found
#include <ext/typelist.h>

error: function-like macro
      '__GLIBC_PREREQ' is not defined
#if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE)

我一次又一次地尝试替换文件,但它总是告诉我要不断地添加我的计算机没有的新文件。 我在Mac上使用VS代码。 谢谢。


共1个答案

匿名用户

宏__glibc_prereq是在中定义的,默认情况下不能保证包含该宏。 您似乎省略了一些重要的头,或者这些头的实现不包括

PBDS需要gcc,说你使用VSCode IDE并不能说明你使用的是什么编译器。