diff --git a/build/make/rtcd.pl b/build/make/rtcd.pl
index 40bcb33d007207c7b66976df9ce77634b3277384..1ed6895762ee195a4d09750de92a01ab1fe41bb8 100755
--- a/build/make/rtcd.pl
+++ b/build/make/rtcd.pl
@@ -209,14 +209,16 @@ sub common_top() {
 #define RTCD_EXTERN extern
 #endif
 
+EOF
+
+process_forward_decls();
+print <<EOF;
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 EOF
-
-process_forward_decls();
-print "\n";
 declare_function_pointers("c", @ALL_ARCHS);
 
 print <<EOF;