I think it would be more correct to compile C++ code with g++ instead of gcc, not just link with libstdc++.