diff --git a/src/ptclib/sockagg.cxx b/src/ptclib/sockagg.cxx
index a8f89d2..c1960f6 100644
--- a/src/ptclib/sockagg.cxx
+++ b/src/ptclib/sockagg.cxx
@@ -38,6 +38,7 @@
 
 #include <ptlib.h>
 #include <ptclib/sockagg.h>
-
+#include <algorithm>
+
 #define new PNEW
 
