guagua0407's blog

By guagua0407, history, 6 weeks 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

»
6 weeks 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).

»
6 weeks 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).

»
6 weeks 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).

»
6 weeks ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it
»
6 weeks 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

»
6 weeks 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.

»
6 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

I faced this problem too. Try to follow this video! You will configure this out.

link: https://www.youtube.com/watch?v=DVJZTNOKD8s

»
6 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

By default g++ is referencing Apple Clang, you can use g++-11 to use Homebrew GCC (or change your aliases to overwrite the Mac OSX defaults)

There is a blog about it https://codeforces.com/blog/entry/101012

»
6 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

sad