Here are various C++ errors I have gotten and some solutions.
If you get
undefined reference to `std::ios_base::Init::Init()
the solution is to link against std c++ libs. In your makefile -
... LIBS = ... -lstdc++