ivanz's blog

By ivanz, history, 3 years ago, translation, In English

Hello! I ran into a following problem. I downloaded Code::Blocks 20.03 MinGW version here. If I select C++14 and try to compile program using bits/stdc++ everything is OK.

But when I select C++17 a mistake occurs:

If I don't use bits/stdc++.h but include the libraries separately everything works with C++14 and with C++17. So the problem is exactly in this library. What I need to do to make bits/stdc++ working with C++17?

UPD: this helps:
#define _GLIBCXX_FILESYSTEM
#include <bits/stdc++.h>

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

| Write comment?
»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Hey, I would recommend you using VS Code as it comes easy to use, with many cool extension support and much larger community base.

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

    I am thinking about starting to use other IDEs, but I would also like to understand what the problem is in this case.

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

      You could try switching to other GCC builds, no need to change IDE. One of those I have installed works with bits/stdc++ and another doesn't. This should be the link to the one that does, but I had other issues with it (unrelated to competitive programming).

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

        I see, thanks for the advice!

»
3 years ago, # |
  Vote: I like it +5 Vote: I do not like it

Try selecting ISO instead of GNU? I used to use Code::Blocks way back in the day and ISO C++17 worked fine.

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

    Unfortunately, it doesn't work either way. But using C++14 both (ISO and GNU) work fine.
    But #define _GLIBCXX_FILESYSTEM helps.

»
3 years ago, # |
  Vote: I like it +15 Vote: I do not like it

Use this to show that you already include <filesystem> that produce this complitation error:

#define _GLIBCXX_FILESYSTEM
#include <bits/stdc++.h>
  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thanks, this works! But can you explain why i don't need to write this while using C++14?

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

      filesystem library was introduced in C++17.

»
23 months ago, # |
  Vote: I like it +8 Vote: I do not like it

Thank you so much. This two-line code is working

#define _GLIBCXX_FILESYSTEM
#include <bits/stdc++.h>

Thank you ivanz