diff --git a/kwsysPlatformTestsCXX.cxx b/kwsysPlatformTestsCXX.cxx
index 3f947f3460c4bdce68034478603d1247937f55a9..82620dadfc43465d720942e8b2bda5e9535bf3d9 100644
--- a/kwsysPlatformTestsCXX.cxx
+++ b/kwsysPlatformTestsCXX.cxx
@@ -548,6 +548,10 @@ int main()
 #if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
 # define _GNU_SOURCE
 #endif
+#if defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x5130 \
+     && __linux && __SUNPRO_CC_COMPAT == 'G'
+#  include <iostream>
+#endif
 #include <cxxabi.h>
 int main()
 {