I know that you can add the c++ linker with -lstdc++ and I do this, yet I am still getting an error. fatal error: iostream: No such file or directory. Hence, gcc doesn't seem to know where to look for the headers.
What is the best way to proceed here, given that g++ is not an option?
Thanks for the help!
Yes, gcc treats a file with extension .cpp as C++ source:
$ cat test.cpp
#include <iostream>
int c;
$ gcc -c test.cpp
$
You can also explicitly specify the language with -x language:
$ mv test.cpp test.c
$ gcc -c -x c++ test.c
$
But why do you want to do this? You should have g++ available and working. If not, that sounds like an incomplete or botched installation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With