Search code examples
c++mingw

oredered_set not compiling in c++


I coded this statement and receiving compilation error. Code :

#include<bits/stdc++.h>
#define ll long long
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds ;
template <typename PB>
using ordered_set = tree<PB,null_type,less_equal<PB>,rb_tree_tag,tree_order_statistics_node_update> ;
int main()
{
    ordered_set s;
    s.insert(5);
}

As far as I know, I didn't made any mistakes here. But I am getting this error messages.

Errors while compiling:
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ext\pb_ds\detail\standard_policies.hpp:45:0,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ext\pb_ds\assoc_container.hpp:47,
                 from c:\Users\asus\Desktop\Contest Probs\Ordered Set.cpp:3:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ext\pb_ds\hash_policy.hpp:610:78: fatal error: ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp: No such file or directory
 #include <ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp>
                                                                              ^
compilation terminated.

Solution

  • I suspect you have a file named c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\ext\pb_ds\detail\resize_policy\hash_standard_resize_policy_imp.hpp0000644. Rename that file to remove the 0000644 from the end of it.