Блог пользователя mental.cat

Автор mental.cat, 11 лет назад, По-русски

Всем привет.

Возникла небольшая проблемка при запуске этой простой проги:

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

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

Компилятор ругается на bits/extc++.h, а именно на то, что не может найти iconv.h (подробнее ругань компилятора можно почитать, запустив этот код даже на http://mirror.codeforces.com/problemset/customtest ). Что делать и как это исправить? А то подключать по одиночке ext/rope и все остальное неохота, когда можно подключить их всех разом. Заранее спасибо.

  • Проголосовать: нравится
  • +4
  • Проголосовать: не нравится

»
11 лет назад, скрыть # |
 
Проголосовать: нравится -17 Проголосовать: не нравится

Why you not try this ?

#include <bits/stdc++.h>

give minus

»
11 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

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.

  • »
    »
    11 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    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?

    • »
      »
      »
      11 лет назад, скрыть # ^ |
      Rev. 3  
      Проголосовать: нравится +3 Проголосовать: не нравится

      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.