guagua0407's blog

By guagua0407, history, 2 years 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?
»
2 years 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).

»
2 years 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).

»
2 years 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).

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

»
2 years 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.

»
2 years ago, # |
  Vote: I like it +1 Vote: I do not like it

sad