The const thing that was added at end of handmade_optimized.cpp can be easily removed.
Change this code in handmade_optimized.cpp file:
 | extern u32 const DebugRecords_Optimized_Count = __COUNTER__;
debug_record DebugRecords_Optimized[DebugRecords_Optimized_Count];
  
 | 
 
to this:
 | debug_record DebugRecords_Optimized[__COUNTER__];
u32 DebugRecords_Optimized_Count = ArrayCount(DebugRecords_Optimized);
  
 | 
 
And in handmade_debug.cpp file where you want to use these variables extern them:
 | extern debug_record DebugRecords_Optimized[];
extern u32 DebugRecords_Optimized_Count;
  
 |