I am learning how to run programs through the terminal on Mac, and I tried running one of my programs:
clang++ /.../file.cpp
clang++ -c /.../file.cpp
and each time I get an error telling me the compiler can’t find the file in the standard library.
10: fatal error: 'iostream' file not found
1 | #include <iostream>
| ^~~~~~~~~~
The same error shows if I replace clang++
with g++
, clang
, and gcc
.
After researching, I used cpp -v
to find where my compiler/computer is looking. I downloaded clang directly from LLVM GitHub, and I then tried using --stdlib
and --stdlib++-isystem
to attempt to redirect the compiler’s search, but each time I use it I get an error message
cpp --stdlib++-isystem <filepath of 'include' directory that contains library>
cc: error: no input files
I would guess that I’m doing things wrong, but I don’t know what I don’t know to fix the problem. Any help?
Vladimir Andral is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
8