diff --git a/dlib/test/hash.cpp b/dlib/test/hash.cpp
index fe492063f0112c22f4a184d956747584ec8f9942..126037773eff8e0a152e31b783b42f797ea2574f 100644
--- a/dlib/test/hash.cpp
+++ b/dlib/test/hash.cpp
@@ -69,7 +69,10 @@ namespace
         bo.host_to_little(hashes);
         final = murmur_hash3(hashes,sizeof(hashes),0);
 
-        dlog << LINFO << hex << "final: "<< final;
+		// using ostringstream to avoid compiler error in visual studio 2005
+		ostringstream sout;
+		sout << hex << final;
+		dlog << LINFO << "final: "<< sout.str();
         DLIB_TEST(final == 0xB0F57EE3);
     }