mental.cat's blog

By mental.cat, 10 years ago, translation, In English

Hello everyone.

There was a problem when I compiled this simple program code:

#include <bits/extc++.h>
using namespace std;
using namespace __gnu_cxx;

int main() {
    printf("Hello world");
    return 0;
}

The compiler (MinGW G++ 4.9.1 and MinGW G++11 4.9.1) complains about the library bits/extc++.h. He can't find iconv.h (you can read the comments of compiler here: http://codeforces.net/problemset/customtest ). What to do and how to fix it? I am so lazy to include libraries from bits/extc++.h by one.
Thanks in advance.
PS. Sorry for my English :)

  • Vote: I like it
  • +4
  • Vote: I do not like it

»
10 years ago, # |
  Vote: I like it -17 Vote: I do not like it

Why you not try this ?

#include <bits/stdc++.h>

give minus

  • »
    »
    10 years ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    I know about it. I read that bits/extc++.h includes all of bits/stdc++.h and bits/stdtr1c++.h and some other features of GNU C++. I just want to understand, why bits/extc++.h doesn't work.

»
10 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Add this before `#include<extc++.h>

#undef _GLIBCXX_HAVE_ICONV

This can solve your problem.

This is wrong. View my next comment.

However, I suggest MikeMirzayanov to check the configure of G++ in Codeforces.

  • »
    »
    10 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thanks, in GNU G++ it works. But G++11 says that must be used flag [-fpermissive] when I run this code in GNU G++11 4.9.2 here:

    #include <bits/stdc++.h>
    #undef _GLIBCXX_HAVE_ICONV
    #include <bits/extc++.h>
    
    using namespace std;
    using namespace __gnu_cxx;
    
    int main() {
        cout << "Hello World";
        return 0;
    }
    

    Where should I apply to use this flag in Codeforces compiler?

    • »
      »
      »
      10 years ago, # ^ |
      Rev. 3   Vote: I like it +3 Vote: I do not like it

      My bad. My previous comment is wrong.

      Use following code at your beginning of source code:

      #define _EXT_CODECVT_SPECIALIZATIONS_H 1
      #define _EXT_ENC_FILEBUF_H 1
      

      It cheats the compiler to ignore two headers causing trouble.

      UPD: It works. I tested them with 9960308

      However, this way is cheating the compiler. So I suggest MikeMirzayanov to check the configure of G++ in Codeforces, again.