--- libemf/libemf.h.orig	2008-11-07 21:20:19.000000000 -0500
+++ libemf/libemf.h	2008-11-07 21:21:45.000000000 -0500
@@ -21,11 +21,14 @@
 #ifndef _LIBEMF_H
 #define _LIBEMF_H 1
 
+#include <iostream>
+#include <ostream>
 #include <cmath>
 #include <vector>
 #include <map>
 #include <functional>
 #include <algorithm>
+#include <ext/functional>
 
 #include <config.h>
 #include <emf.h>
--- libemf/libemf.cpp.orig	2008-11-07 21:21:56.000000000 -0500
+++ libemf/libemf.cpp	2008-11-07 21:31:26.000000000 -0500
@@ -48,7 +48,7 @@
       be32 = !be16;
 
     if ( be32 != be16 ) {
-      cerr << "endian-ness not consistent between short's and int's!" << endl;
+      std::cerr << "endian-ness not consistent between short's and int's!" << std::endl;
       ::abort();
     }
 
@@ -849,8 +849,7 @@
     if ( dc->fp ) {
 
       std::for_each( dc->records.begin(), dc->records.end(),
-		     std::bind2nd( std::mem_fun1( &EMF::METARECORD::serialize ),
-				   dc->ds ) );
+	std::bind2nd( __gnu_cxx::mem_fun1( &EMF::METARECORD::serialize ), dc->ds ) );
       fclose( dc->fp );
 
       dc->fp = 0;
@@ -896,8 +895,7 @@
     if ( dc->fp ) {
 
       std::for_each( dc->records.begin(), dc->records.end(),
-		     std::bind2nd( std::mem_fun1( &EMF::METARECORD::serialize ),
-				   dc->ds ) );
+		     std::bind2nd( __gnu_cxx::mem_fun1( &EMF::METARECORD::serialize ), dc->ds ) );
     }
 
     // There's no particular reason to distinguish between the context and
@@ -1032,7 +1030,7 @@
       if ( feof( fp ) ) break;
 
       if ( emr.nSize == 0 ) {
-	cerr << "GetEnhMetaFileW error: record size == 0. cannot continue" << endl;
+	std::cerr << "GetEnhMetaFileW error: record size == 0. cannot continue" << std::endl;
 	fclose( fp );
 	return 0;
       }
@@ -1050,9 +1048,8 @@
 	dc->appendRecord( record );
       }
       else
-	cerr << "GetEnhMetaFileW warning: read unknown record type " << emr.iType
-	     << " of size " << emr.nSize << endl;
-
+            std::cerr << "GetEnhMetaFileW warning: read unknown record type " << emr.iType
+               << " of size " << emr.nSize << std::endl;
       // Regardless, position ourselves at the next record.
       fseek( fp, next_position, SEEK_SET );
     }
