diff --git a/ChangeLog b/ChangeLog
index efd8ae7422fee7f6d8ebcc067aa54207bbaf6a03..1270207c7a88d69f18802ecb71556e03e7957ab6 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2005-11-08  Kevin P. Fleming  <kpfleming@digium.com>
 
+	* include/asterisk/file.h: add test to ensure that stdio.h is included before this file (issue #5658)
+
 	* res/res_odbc.c (odbc_prepare_and_execute): add new API call for use to properly handle prepared statements across server disconnects (issue #5563)
 
 	* pbx.c (pbx_substitute_variables_helper_full): use already-substituted buffer for parsing variable name (issue #5664)
diff --git a/include/asterisk/file.h b/include/asterisk/file.h
index 147a705d8eaac5b8a40407379d675ed1f5a516ae..e5257018379119b5989be5ea7e6d62fab8a85180 100755
--- a/include/asterisk/file.h
+++ b/include/asterisk/file.h
@@ -23,6 +23,10 @@
 #ifndef _ASTERISK_FILE_H
 #define _ASTERISK_FILE_H
 
+#ifndef stdin
+#error You must include stdio.h before file.h!
+#endif /* !stdin */
+
 #include "asterisk/channel.h"
 #include "asterisk/frame.h"
 #include <fcntl.h>