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

Policy data structure on my compiler is not working

本文关键字:数据结构 不起作用 策略 编译器      更新时间:2023-10-16

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

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

#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代码。谢谢。

宏__GLIBC_PREREQ在<cstdlib>中定义,不能保证默认包含。看起来您省略了一些重要的标头,或者这些标头的实现不包括<cstdlib>

PBDS需要gcc,说你使用VSCode IDE并不能告诉你正在使用什么编译器。