Satya's blog - How to compile C++ with GCC

Aug 29 2004 08:41 How to compile C++ with GCC
In the midst of TS/Hurricane Gaston, I find this.
If you compile gcc t.cc, it does not find the standard C++ library stdc++.
If you compile gcc -lstdc++ t.cc, it works fine.
If you compile g++ t.cc, it works fine.
But you must always have your program like this:
#include <iostream>
using namespace std;
int main() {
cout << "Hello world" << endl;
return 0;
}
or:
#include <iostream>
int main() {
std::cout << "Hello world" << std::endl;
return 0;
}
Gotta have the right namespace. And no using iostream.h

Tag: tech howto