The const thing that was added at end of handmade_optimized.cpp can be easily removed.

Change this code in handmade_optimized.cpp file:
1
2
extern u32 const DebugRecords_Optimized_Count = __COUNTER__;
debug_record DebugRecords_Optimized[DebugRecords_Optimized_Count];


to this:
1
2
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:
1
2
extern debug_record DebugRecords_Optimized[];
extern u32 DebugRecords_Optimized_Count;