Updated for c++98 compatibility
diff --git a/python/google/protobuf/pyext/extension_dict.h b/python/google/protobuf/pyext/extension_dict.h
index 0cac8ba..352495b 100644
--- a/python/google/protobuf/pyext/extension_dict.h
+++ b/python/google/protobuf/pyext/extension_dict.h
@@ -47,8 +47,9 @@
 class Message;
 class FieldDescriptor;
 
+#ifdef _SHARED_PTR_H
 using std::shared_ptr;
-using std::string;
+#endif
 
 namespace python {
 
diff --git a/python/google/protobuf/pyext/message.h b/python/google/protobuf/pyext/message.h
index d4b7f4c..5b495e8 100644
--- a/python/google/protobuf/pyext/message.h
+++ b/python/google/protobuf/pyext/message.h
@@ -52,8 +52,10 @@
 class DescriptorPool;
 class MessageFactory;
 
+#ifdef _SHARED_PTR_H
 using std::shared_ptr;
 using std::string;
+#endif
 
 namespace python {
 
diff --git a/python/google/protobuf/pyext/message_map_container.h b/python/google/protobuf/pyext/message_map_container.h
index 270922d..d65ac4d 100644
--- a/python/google/protobuf/pyext/message_map_container.h
+++ b/python/google/protobuf/pyext/message_map_container.h
@@ -45,8 +45,9 @@
 
 class Message;
 
+#ifdef _SHARED_PTR_H
 using std::shared_ptr;
-using std::string;
+#endif
 
 namespace python {
 
diff --git a/python/google/protobuf/pyext/repeated_composite_container.h b/python/google/protobuf/pyext/repeated_composite_container.h
index 494db0e..37f7b7e 100644
--- a/python/google/protobuf/pyext/repeated_composite_container.h
+++ b/python/google/protobuf/pyext/repeated_composite_container.h
@@ -49,8 +49,9 @@
 class FieldDescriptor;
 class Message;
 
+#ifdef _SHARED_PTR_H
 using std::shared_ptr;
-using std::string;
+#endif
 
 namespace python {
 
diff --git a/python/google/protobuf/pyext/repeated_scalar_container.h b/python/google/protobuf/pyext/repeated_scalar_container.h
index a13cf9b..bd73017 100644
--- a/python/google/protobuf/pyext/repeated_scalar_container.h
+++ b/python/google/protobuf/pyext/repeated_scalar_container.h
@@ -48,8 +48,9 @@
 
 class Message;
 
+#ifdef _SHARED_PTR_H
 using std::shared_ptr;
-using std::string;
+#endif
 
 namespace python {
 
diff --git a/python/google/protobuf/pyext/scalar_map_container.h b/python/google/protobuf/pyext/scalar_map_container.h
index 8807892..c055d1b 100644
--- a/python/google/protobuf/pyext/scalar_map_container.h
+++ b/python/google/protobuf/pyext/scalar_map_container.h
@@ -45,8 +45,9 @@
 
 class Message;
 
+#ifdef _SHARED_PTR_H
 using std::shared_ptr;
-using std::string;
+#endif
 
 namespace python {