When submitting a solution in C++, please select either C++14 (GCC 6-32) or C++17 (GCC 7-32) as your compiler. ×

guagua0407's blog

By guagua0407, history, 20 months ago, In English

Hi, I'm a mac user. Recently I tried to run code on terminal, but this error appeared.

ans.cpp:1:10: fatal error: 'bits/stdc++.h' file not found

include <bits/stdc++.h>

^~~~~~~~~~~~~~~

1 error generated.

I then searched for solutions and found out that installing gcc with homebrew would work, so I installed gcc.

But it still showed the same error, Can anyone help me find out why?

Thank you

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

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

Auto comment: topic has been updated by guagua0407 (previous revision, new revision, compare).

»
20 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by guagua0407 (previous revision, new revision, compare).

»
20 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by guagua0407 (previous revision, new revision, compare).

»
20 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it
»
20 months ago, # |
Rev. 2   Vote: I like it +16 Vote: I do not like it

The command for compilation using gcc is g++-11. g++ defaults to clang on MacOS.

Here's the general compilation command : g++-11 -std=c++17

»
20 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Maybe the include path does not have the gcc library? I faced a similar issue and my include path was not set up properly for some reason.

»
20 months ago, # |
  Vote: I like it +1 Vote: I do not like it

sad