Reputation: 6711
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!
Upvotes: 4
Views: 4811
Reputation: 72639
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.
Upvotes: 3