diff --git a/common/board_printout.cpp b/common/board_printout.cpp
index 603a2649eb..50ed827697 100644
--- a/common/board_printout.cpp
+++ b/common/board_printout.cpp
@@ -28,6 +28,7 @@
 
 #include <view/view.h>
 #include <gal/gal_print.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <gal/painter.h>
 #include <pcbplot.h>
 #include <settings/app_settings.h>
diff --git a/common/drawing_sheet/ds_proxy_view_item.cpp b/common/drawing_sheet/ds_proxy_view_item.cpp
index b518d4f884..83beabaf78 100644
--- a/common/drawing_sheet/ds_proxy_view_item.cpp
+++ b/common/drawing_sheet/ds_proxy_view_item.cpp
@@ -29,6 +29,7 @@
 #include <drawing_sheet/ds_draw_item.h>
 #include <drawing_sheet/ds_data_item.h>
 #include <drawing_sheet/ds_painter.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <project.h>
 #include <view/view.h>
 
diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp
index f1380801ce..944a3fdc27 100644
--- a/common/eda_draw_frame.cpp
+++ b/common/eda_draw_frame.cpp
@@ -32,6 +32,7 @@
 #include <dialogs/hotkey_cycle_popup.h>
 #include <eda_draw_frame.h>
 #include <file_history.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <id.h>
 #include <kiface_base.h>
 #include <lockfile.h>
diff --git a/common/font/outline_font.cpp b/common/font/outline_font.cpp
index 4637f8727a..40c380d03c 100644
--- a/common/font/outline_font.cpp
+++ b/common/font/outline_font.cpp
@@ -34,6 +34,7 @@
 #include <trigo.h>
 #include <font/fontconfig.h>
 #include <convert_basic_shapes_to_polygon.h>
+#include <core/utf8.h>
 
 using namespace KIFONT;
 
diff --git a/common/preview_items/draw_context.cpp b/common/preview_items/draw_context.cpp
index f212ebd9c4..cf7811b4c2 100644
--- a/common/preview_items/draw_context.cpp
+++ b/common/preview_items/draw_context.cpp
@@ -21,6 +21,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
  */
 
+#include <gal/graphics_abstraction_layer.h>
 #include <preview_items/draw_context.h>
 #include <preview_items/preview_utils.h>
 #include <view/view.h>
diff --git a/common/preview_items/polygon_item.cpp b/common/preview_items/polygon_item.cpp
index a7560a3c15..107dcbd40d 100644
--- a/common/preview_items/polygon_item.cpp
+++ b/common/preview_items/polygon_item.cpp
@@ -22,6 +22,7 @@
  */
 
 #include <preview_items/polygon_item.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <gal/painter.h>
 #include <view/view.h>
 
diff --git a/common/preview_items/two_point_assistant.cpp b/common/preview_items/two_point_assistant.cpp
index d8da87794d..04d8fca095 100644
--- a/common/preview_items/two_point_assistant.cpp
+++ b/common/preview_items/two_point_assistant.cpp
@@ -21,6 +21,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
  */
 
+#include <gal/graphics_abstraction_layer.h>
 #include <preview_items/two_point_assistant.h>
 #include <preview_items/draw_context.h>
 #include <preview_items/preview_utils.h>
diff --git a/common/tool/grid_helper.cpp b/common/tool/grid_helper.cpp
index d8f25cc279..25ff0cf2c8 100644
--- a/common/tool/grid_helper.cpp
+++ b/common/tool/grid_helper.cpp
@@ -25,6 +25,7 @@
 #include <functional>
 using namespace std::placeholders;
 
+#include <gal/graphics_abstraction_layer.h>
 #include <math/util.h>      // for KiROUND
 #include <math/vector2d.h>
 #include <tool/tool_manager.h>
@@ -158,3 +159,7 @@ VECTOR2I GRID_HELPER::Align( const VECTOR2I& aPoint, const VECTOR2D& aGrid,
 }
 
 
+bool GRID_HELPER::canUseGrid() const
+{
+    return m_enableGrid && m_toolMgr->GetView()->GetGAL()->GetGridSnapping();
+}
\ No newline at end of file
diff --git a/eeschema/dialogs/panel_eeschema_color_settings.cpp b/eeschema/dialogs/panel_eeschema_color_settings.cpp
index bbdee49c9a..aecec16164 100644
--- a/eeschema/dialogs/panel_eeschema_color_settings.cpp
+++ b/eeschema/dialogs/panel_eeschema_color_settings.cpp
@@ -22,6 +22,7 @@
 
 #include <eeschema_settings.h>
 #include <gal/gal_display_options.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <layer_ids.h>
 #include <lib_shape.h>
 #include <math/vector2wx.h>
diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp
index f1aa0c548d..5eb3e3e604 100644
--- a/eeschema/erc.cpp
+++ b/eeschema/erc.cpp
@@ -31,6 +31,7 @@
 #include <common.h>     // for ExpandEnvVarSubstitutions
 #include <erc.h>
 #include <erc_sch_pin_context.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <string_utils.h>
 #include <lib_pin.h>
 #include <sch_edit_frame.h>
diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp
index 5d6f32aec5..ae5f9abe7a 100644
--- a/eeschema/lib_field.cpp
+++ b/eeschema/lib_field.cpp
@@ -28,6 +28,7 @@
 #include <sch_draw_panel.h>
 #include <eda_draw_frame.h>
 #include <plotters/plotter.h>
+#include <font/font.h>
 #include <trigo.h>
 #include <base_units.h>
 #include <widgets/msgpanel.h>
diff --git a/eeschema/lib_item.cpp b/eeschema/lib_item.cpp
index b376849062..4682b36f15 100644
--- a/eeschema/lib_item.cpp
+++ b/eeschema/lib_item.cpp
@@ -24,6 +24,7 @@
  */
 
 #include <pgm_base.h>
+#include <font/font.h>
 #include <settings/settings_manager.h>
 #include <eeschema_settings.h>
 #include <sch_draw_panel.h>
diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp
index ab9878c985..a784cef711 100644
--- a/eeschema/lib_text.cpp
+++ b/eeschema/lib_text.cpp
@@ -22,6 +22,7 @@
  */
 
 #include <common.h>
+#include <font/font.h>
 #include <sch_draw_panel.h>
 #include <plotters/plotter.h>
 #include <trigo.h>
diff --git a/eeschema/navlib/nl_schematic_plugin_impl.cpp b/eeschema/navlib/nl_schematic_plugin_impl.cpp
index 56284b76e4..d800e2c689 100644
--- a/eeschema/navlib/nl_schematic_plugin_impl.cpp
+++ b/eeschema/navlib/nl_schematic_plugin_impl.cpp
@@ -21,6 +21,7 @@
 #include "nl_schematic_plugin_impl.h"
 
 // KiCAD includes
+#include <gal/graphics_abstraction_layer.h>
 #include <sch_base_frame.h>
 #include <bitmaps.h>
 #include <class_draw_panel_gal.h>
diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp
index f789470bb0..7e356be796 100644
--- a/eeschema/sch_base_frame.cpp
+++ b/eeschema/sch_base_frame.cpp
@@ -29,6 +29,7 @@
 #include <pgm_base.h>
 #include <eda_list_dialog.h>
 #include <eeschema_settings.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <project/project_file.h>
 #include <symbol_editor/symbol_editor_settings.h>
 #include <sch_draw_panel.h>
diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp
index 0a343e6ca4..7dc6247db2 100644
--- a/eeschema/sch_edit_frame.cpp
+++ b/eeschema/sch_edit_frame.cpp
@@ -33,6 +33,7 @@
 #include <dialogs/dialog_symbol_fields_table.h>
 #include <eeschema_id.h>
 #include <executable_names.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <gestfich.h>
 #include <dialogs/html_message_box.h>
 #include <core/ignore.h>
diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp
index abef369e45..bfd46c8a27 100644
--- a/eeschema/sch_screen.cpp
+++ b/eeschema/sch_screen.cpp
@@ -24,6 +24,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
  */
 
+#include <stack>
 #include <wx/filefn.h>
 
 #include <eda_item.h>
diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp
index ebcba7ec7c..4b381e9b9f 100644
--- a/eeschema/symbol_editor/symbol_edit_frame.cpp
+++ b/eeschema/symbol_editor/symbol_edit_frame.cpp
@@ -32,6 +32,7 @@
 #include <eeschema_id.h>
 #include <eeschema_settings.h>
 #include <env_paths.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <kiface_base.h>
 #include <kiplatform/app.h>
 #include <kiway_express.h>
diff --git a/eeschema/symbol_viewer_frame.cpp b/eeschema/symbol_viewer_frame.cpp
index 2d5044e5bb..efd8a58be2 100644
--- a/eeschema/symbol_viewer_frame.cpp
+++ b/eeschema/symbol_viewer_frame.cpp
@@ -30,6 +30,7 @@
 #include <dialogs/html_message_box.h>
 #include <eeschema_id.h>
 #include <eeschema_settings.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <kiface_base.h>
 #include <kiway.h>
 #include <kiway_express.h>
diff --git a/eeschema/tools/ee_grid_helper.cpp b/eeschema/tools/ee_grid_helper.cpp
index 224d39095a..315647a813 100644
--- a/eeschema/tools/ee_grid_helper.cpp
+++ b/eeschema/tools/ee_grid_helper.cpp
@@ -25,6 +25,7 @@
 
 #include <functional>
 #include <macros.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <sch_item.h>
 #include <sch_line.h>
 #include <sch_painter.h>
diff --git a/eeschema/tools/ee_inspection_tool.cpp b/eeschema/tools/ee_inspection_tool.cpp
index ae25d09954..9db13a1308 100644
--- a/eeschema/tools/ee_inspection_tool.cpp
+++ b/eeschema/tools/ee_inspection_tool.cpp
@@ -27,6 +27,7 @@
 #include <kiway.h>
 #include <confirm.h>
 #include <string_utils.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <tool/conditional_menu.h>
 #include <tool/selection_conditions.h>
 #include <tools/ee_actions.h>
diff --git a/eeschema/tools/ee_point_editor.cpp b/eeschema/tools/ee_point_editor.cpp
index 5ab037055f..f7c6e556c9 100644
--- a/eeschema/tools/ee_point_editor.cpp
+++ b/eeschema/tools/ee_point_editor.cpp
@@ -30,6 +30,7 @@ using namespace std::placeholders;
 #include <tool/tool_manager.h>
 #include <sch_commit.h>
 #include <view/view_controls.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <geometry/seg.h>
 #include <tools/ee_actions.h>
 #include <tools/ee_selection_tool.h>
diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp
index 65ff12b335..6af5949c58 100644
--- a/eeschema/tools/ee_selection_tool.cpp
+++ b/eeschema/tools/ee_selection_tool.cpp
@@ -24,6 +24,7 @@
 
 #include <core/typeinfo.h>
 #include <core/kicad_algo.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <geometry/shape_compound.h>
 #include <ee_actions.h>
 #include <ee_collectors.h>
diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp
index deec4b4995..0420a76c5c 100644
--- a/eeschema/tools/sch_drawing_tools.cpp
+++ b/eeschema/tools/sch_drawing_tools.cpp
@@ -29,6 +29,7 @@
 #include <tools/sch_line_wire_bus_tool.h>
 #include <tools/ee_selection_tool.h>
 #include <tools/ee_grid_helper.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <ee_actions.h>
 #include <sch_edit_frame.h>
 #include <pgm_base.h>
diff --git a/eeschema/tools/sch_line_wire_bus_tool.cpp b/eeschema/tools/sch_line_wire_bus_tool.cpp
index 19055d0cd4..1ee6da2457 100644
--- a/eeschema/tools/sch_line_wire_bus_tool.cpp
+++ b/eeschema/tools/sch_line_wire_bus_tool.cpp
@@ -38,6 +38,7 @@
 #include <layer_ids.h>
 #include <math/vector2d.h>
 #include <advanced_config.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <tool/actions.h>
 #include <tool/conditional_menu.h>
 #include <tool/selection.h>
diff --git a/eeschema/tools/sch_move_tool.cpp b/eeschema/tools/sch_move_tool.cpp
index 07e29a9271..35cdcbfbcd 100644
--- a/eeschema/tools/sch_move_tool.cpp
+++ b/eeschema/tools/sch_move_tool.cpp
@@ -25,6 +25,7 @@
 #include <cmath>
 #include <wx/log.h>
 #include <trigo.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <tool/tool_manager.h>
 #include <tools/ee_grid_helper.h>
 #include <tools/ee_selection_tool.h>
diff --git a/eeschema/tools/symbol_editor_drawing_tools.cpp b/eeschema/tools/symbol_editor_drawing_tools.cpp
index b5557ebb92..da6ab3a36a 100644
--- a/eeschema/tools/symbol_editor_drawing_tools.cpp
+++ b/eeschema/tools/symbol_editor_drawing_tools.cpp
@@ -26,6 +26,7 @@
 #include <optional>
 #include <symbol_edit_frame.h>
 #include <sch_commit.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <tools/symbol_editor_drawing_tools.h>
 #include <tools/symbol_editor_pin_tool.h>
 #include <tools/ee_grid_helper.h>
diff --git a/eeschema/tools/symbol_editor_move_tool.cpp b/eeschema/tools/symbol_editor_move_tool.cpp
index 705de4bcc9..53041f7f62 100644
--- a/eeschema/tools/symbol_editor_move_tool.cpp
+++ b/eeschema/tools/symbol_editor_move_tool.cpp
@@ -27,6 +27,7 @@
 #include <ee_actions.h>
 #include <ee_grid_helper.h>
 #include <eda_item.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <lib_shape.h>
 #include <sch_commit.h>
 #include <wx/log.h>
diff --git a/eeschema/widgets/symbol_preview_widget.cpp b/eeschema/widgets/symbol_preview_widget.cpp
index 488cb5b14e..ea1ac27ec2 100644
--- a/eeschema/widgets/symbol_preview_widget.cpp
+++ b/eeschema/widgets/symbol_preview_widget.cpp
@@ -20,6 +20,7 @@
 #include "symbol_preview_widget.h"
 #include <sch_view.h>
 #include <gal/gal_display_options.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <math/vector2wx.h>
 #include <symbol_lib_table.h>
 #include <sch_preview_panel.h>
diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp
index ad9b46db15..a2eeee5b8a 100644
--- a/gerbview/gerbview_frame.cpp
+++ b/gerbview/gerbview_frame.cpp
@@ -23,6 +23,7 @@
 #include <pgm_base.h>
 #include <bitmaps.h>
 #include <wildcards_and_files_ext.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <gerbview_frame.h>
 #include <gerbview_id.h>
 #include <gerber_file_image.h>
diff --git a/gerbview/gerbview_printout.cpp b/gerbview/gerbview_printout.cpp
index e4e7e3e435..09b6e39cfd 100644
--- a/gerbview/gerbview_printout.cpp
+++ b/gerbview/gerbview_printout.cpp
@@ -24,6 +24,7 @@
 
 #include <base_units.h>
 #include <base_screen.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <gerbview_frame.h>
 #include <gerber_file_image.h>
 #include <gerber_file_image_list.h>
diff --git a/include/font/outline_font.h b/include/font/outline_font.h
index e483ab1dea..42784b46a6 100644
--- a/include/font/outline_font.h
+++ b/include/font/outline_font.h
@@ -27,7 +27,6 @@
 #ifndef OUTLINE_FONT_H_
 #define OUTLINE_FONT_H_
 
-#include <gal/graphics_abstraction_layer.h>
 #include <geometry/shape_poly_set.h>
 #ifdef _MSC_VER
 #include <ft2build.h>
diff --git a/include/tool/grid_helper.h b/include/tool/grid_helper.h
index d37183658b..5e87222591 100644
--- a/include/tool/grid_helper.h
+++ b/include/tool/grid_helper.h
@@ -161,10 +161,7 @@ protected:
      * Check whether it is possible to use the grid -- this depends both on local grid helper
      * settings and global (tool manager) KiCad settings.
      */
-    bool canUseGrid() const
-    {
-        return m_enableGrid && m_toolMgr->GetView()->GetGAL()->GetGridSnapping();
-    }
+    bool canUseGrid() const;
 
     VECTOR2I computeNearest( const VECTOR2I& aPoint, const VECTOR2I& aGrid,
                              const VECTOR2I& aOffset ) const;
diff --git a/include/view/view_overlay.h b/include/view/view_overlay.h
index c8f6a30dfc..b5633e48ba 100644
--- a/include/view/view_overlay.h
+++ b/include/view/view_overlay.h
@@ -28,7 +28,6 @@
 #define __VIEW_OVERLAY_H
 
 #include <view/view_item.h>
-#include <gal/graphics_abstraction_layer.h>
 
 #include <vector>
 #include <deque>
diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp
index 3b93c955e7..61c1d6d433 100644
--- a/pagelayout_editor/pl_editor_frame.cpp
+++ b/pagelayout_editor/pl_editor_frame.cpp
@@ -32,6 +32,7 @@
 #include <panel_hotkeys_editor.h>
 #include <confirm.h>
 #include <kiplatform/app.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <gal/painter.h>
 #include <wildcards_and_files_ext.h>
 #include <tool/selection.h>
diff --git a/pcbnew/board_item.cpp b/pcbnew/board_item.cpp
index 7b146330d2..fb64435af3 100644
--- a/pcbnew/board_item.cpp
+++ b/pcbnew/board_item.cpp
@@ -33,6 +33,7 @@
 #include <board_design_settings.h>
 #include <pcb_group.h>
 #include <footprint.h>
+#include <font/font.h>
 
 
 BOARD_ITEM::~BOARD_ITEM()
diff --git a/pcbnew/dialogs/dialog_board_reannotate.cpp b/pcbnew/dialogs/dialog_board_reannotate.cpp
index a9b145a261..6b0ea90d98 100644
--- a/pcbnew/dialogs/dialog_board_reannotate.cpp
+++ b/pcbnew/dialogs/dialog_board_reannotate.cpp
@@ -30,6 +30,7 @@
 #include <confirm.h>
 #include <ctype.h>
 #include <dialog_board_reannotate.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <string_utils.h>  // StrNumCmp
 #include <kiface_base.h>
 #include <pcbnew_settings.h>
diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp
index e50a7cab34..983a5f2837 100644
--- a/pcbnew/dialogs/dialog_pad_properties.cpp
+++ b/pcbnew/dialogs/dialog_pad_properties.cpp
@@ -33,6 +33,7 @@
 #include <confirm.h>
 #include <core/arraydim.h>
 #include <convert_basic_shapes_to_polygon.h> // for enum RECT_CHAMFER_POSITIONS definition
+#include <gal/graphics_abstraction_layer.h>
 #include <geometry/shape_segment.h>
 #include <dialog_pad_properties.h>
 #include <dialogs/html_message_box.h>
diff --git a/pcbnew/dialogs/panel_pcbnew_color_settings.cpp b/pcbnew/dialogs/panel_pcbnew_color_settings.cpp
index f2da226537..8d3d11a622 100644
--- a/pcbnew/dialogs/panel_pcbnew_color_settings.cpp
+++ b/pcbnew/dialogs/panel_pcbnew_color_settings.cpp
@@ -23,6 +23,7 @@
 #include <pgm_base.h>
 #include <board.h>
 #include <layer_ids.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <panel_pcbnew_color_settings.h>
 #include <math/vector2wx.h>
 #include <widgets/wx_panel.h>
diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp
index 33c58262b4..b56bab4c4b 100644
--- a/pcbnew/footprint_edit_frame.cpp
+++ b/pcbnew/footprint_edit_frame.cpp
@@ -42,6 +42,7 @@
 #include <footprint_info_impl.h>
 #include <footprint_tree_pane.h>
 #include <fp_lib_table.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <kiface_base.h>
 #include <kiplatform/app.h>
 #include <kiway.h>
diff --git a/pcbnew/footprint_preview_panel.cpp b/pcbnew/footprint_preview_panel.cpp
index e96a49fa49..478f0e813f 100644
--- a/pcbnew/footprint_preview_panel.cpp
+++ b/pcbnew/footprint_preview_panel.cpp
@@ -31,6 +31,7 @@
 #include <eda_draw_frame.h>
 #include <footprint_preview_panel.h>
 #include <fp_lib_table.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <kiway.h>
 #include <math/box2.h>
 #include <pcb_painter.h>
diff --git a/pcbnew/footprint_viewer_frame.cpp b/pcbnew/footprint_viewer_frame.cpp
index 6ab2c1ea79..917320c83a 100644
--- a/pcbnew/footprint_viewer_frame.cpp
+++ b/pcbnew/footprint_viewer_frame.cpp
@@ -39,6 +39,7 @@
 #include <widgets/msgpanel.h>
 #include <widgets/wx_listbox.h>
 #include <widgets/wx_aui_utils.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <pcb_draw_panel_gal.h>
 #include <pcb_painter.h>
 #include <pcbnew_id.h>
diff --git a/pcbnew/fp_tree_synchronizing_adapter.cpp b/pcbnew/fp_tree_synchronizing_adapter.cpp
index 01c250a607..7b5ec24774 100644
--- a/pcbnew/fp_tree_synchronizing_adapter.cpp
+++ b/pcbnew/fp_tree_synchronizing_adapter.cpp
@@ -30,6 +30,7 @@
 #include <footprint_preview_panel.h>
 #include <fp_lib_table.h>
 #include <footprint_info_impl.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <string_utils.h>
 #include <board.h>
 #include <footprint.h>
diff --git a/pcbnew/navlib/nl_pcbnew_plugin_impl.cpp b/pcbnew/navlib/nl_pcbnew_plugin_impl.cpp
index e717e51fba..6fb20801ab 100644
--- a/pcbnew/navlib/nl_pcbnew_plugin_impl.cpp
+++ b/pcbnew/navlib/nl_pcbnew_plugin_impl.cpp
@@ -24,6 +24,7 @@
 #include <board.h>
 #include <pcb_base_frame.h>
 #include <bitmaps.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <class_draw_panel_gal.h>
 #include <view/view.h>
 #include <view/wx_view_controls.h>
diff --git a/pcbnew/pcb_base_edit_frame.cpp b/pcbnew/pcb_base_edit_frame.cpp
index ab9b3e26a5..fe77b21b27 100644
--- a/pcbnew/pcb_base_edit_frame.cpp
+++ b/pcbnew/pcb_base_edit_frame.cpp
@@ -33,6 +33,7 @@
 #include <pgm_base.h>
 #include <board.h>
 #include <board_design_settings.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <pcb_dimension.h>
 #include <footprint.h>
 #include <footprint_info_impl.h>
diff --git a/pcbnew/pcb_dimension.cpp b/pcbnew/pcb_dimension.cpp
index 40fa481999..47a54a2fd0 100644
--- a/pcbnew/pcb_dimension.cpp
+++ b/pcbnew/pcb_dimension.cpp
@@ -28,6 +28,7 @@
 #include <pcb_edit_frame.h>
 #include <base_units.h>
 #include <convert_basic_shapes_to_polygon.h>
+#include <font/font.h>
 #include <pcb_dimension.h>
 #include <pcb_text.h>
 #include <geometry/shape_compound.h>
diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp
index a1ddf3d61e..4b5b0a34f9 100644
--- a/pcbnew/pcb_edit_frame.cpp
+++ b/pcbnew/pcb_edit_frame.cpp
@@ -41,6 +41,7 @@
 #include <dialogs/dialog_net_inspector.h>
 #include <dialog_board_setup.h>
 #include <invoke_pcb_dialog.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <board.h>
 #include <pcb_group.h>
 #include <board_design_settings.h>
diff --git a/pcbnew/pcbnew_printout.cpp b/pcbnew/pcbnew_printout.cpp
index fd28d2b53a..16a4e1b3dd 100644
--- a/pcbnew/pcbnew_printout.cpp
+++ b/pcbnew/pcbnew_printout.cpp
@@ -28,6 +28,7 @@
 #include "pcbnew_printout.h"
 #include <board.h>
 #include <math/util.h>      // for KiROUND
+#include <gal/graphics_abstraction_layer.h>
 #include <pcb_painter.h>
 #include <pcbnew_settings.h>
 #include <view/view.h>
diff --git a/pcbnew/plugins/eagle/eagle_plugin.cpp b/pcbnew/plugins/eagle/eagle_plugin.cpp
index 87c6f75939..86c47fb24d 100644
--- a/pcbnew/plugins/eagle/eagle_plugin.cpp
+++ b/pcbnew/plugins/eagle/eagle_plugin.cpp
@@ -58,6 +58,7 @@ Load() TODO's
 #include <wx/log.h>
 #include <wx/wfstream.h>
 #include <wx/txtstrm.h>
+#include <wx/window.h>
 
 #include <convert_basic_shapes_to_polygon.h>
 #include <string_utils.h>
diff --git a/pcbnew/plugins/easyeda/pcb_easyeda_parser.cpp b/pcbnew/plugins/easyeda/pcb_easyeda_parser.cpp
index a512d57f71..8a3ca9df87 100644
--- a/pcbnew/plugins/easyeda/pcb_easyeda_parser.cpp
+++ b/pcbnew/plugins/easyeda/pcb_easyeda_parser.cpp
@@ -33,6 +33,7 @@
 
 #include <wx/log.h>
 
+#include <font/font.h>
 #include <footprint.h>
 #include <progress_reporter.h>
 #include <board.h>
diff --git a/pcbnew/plugins/easyedapro/pcb_easyedapro_parser.cpp b/pcbnew/plugins/easyedapro/pcb_easyedapro_parser.cpp
index 256860bde2..faa9bff206 100644
--- a/pcbnew/plugins/easyedapro/pcb_easyedapro_parser.cpp
+++ b/pcbnew/plugins/easyedapro/pcb_easyedapro_parser.cpp
@@ -46,6 +46,7 @@
 #include <pcb_track.h>
 #include <pcb_shape.h>
 #include <pcb_text.h>
+#include <font/font.h>
 #include <geometry/shape_arc.h>
 #include <geometry/shape_circle.h>
 #include <geometry/shape_simple.h>
diff --git a/pcbnew/python/scripting/pcbnew_action_plugins.cpp b/pcbnew/python/scripting/pcbnew_action_plugins.cpp
index ab64a563c1..35ada32258 100644
--- a/pcbnew/python/scripting/pcbnew_action_plugins.cpp
+++ b/pcbnew/python/scripting/pcbnew_action_plugins.cpp
@@ -30,6 +30,7 @@
 #include <board_commit.h>
 #include <board_design_settings.h>
 #include <footprint.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <pcb_track.h>
 #include <zone.h>
 #include <menus_helpers.h>
diff --git a/pcbnew/ratsnest/ratsnest_view_item.cpp b/pcbnew/ratsnest/ratsnest_view_item.cpp
index bcab80eb2e..a7bf6e745e 100644
--- a/pcbnew/ratsnest/ratsnest_view_item.cpp
+++ b/pcbnew/ratsnest/ratsnest_view_item.cpp
@@ -31,6 +31,7 @@
 #include <ratsnest/ratsnest_view_item.h>
 
 #include <kiface_base.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <pcbnew_settings.h>
 #include <pcb_painter.h>
 #include <ratsnest/ratsnest_data.h>
diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp
index 40d5cba19c..8892410f0a 100644
--- a/pcbnew/router/pns_kicad_iface.cpp
+++ b/pcbnew/router/pns_kicad_iface.cpp
@@ -37,6 +37,7 @@
 #include <tool/tool_manager.h>
 #include <settings/app_settings.h>
 
+#include <gal/graphics_abstraction_layer.h>
 #include <pcb_painter.h>
 
 #include <geometry/shape.h>
diff --git a/pcbnew/router/pns_tool_base.cpp b/pcbnew/router/pns_tool_base.cpp
index b8023ed612..7d22b9ba33 100644
--- a/pcbnew/router/pns_tool_base.cpp
+++ b/pcbnew/router/pns_tool_base.cpp
@@ -23,6 +23,7 @@
 #include <functional>
 using namespace std::placeholders;
 
+#include <gal/graphics_abstraction_layer.h>
 #include <pcb_painter.h>
 #include <pcbnew_settings.h>
 
diff --git a/pcbnew/router/router_preview_item.cpp b/pcbnew/router/router_preview_item.cpp
index 2d905b0abf..c2d4df5bca 100644
--- a/pcbnew/router/router_preview_item.cpp
+++ b/pcbnew/router/router_preview_item.cpp
@@ -22,6 +22,7 @@
 #include <deque>
 #include <gal/color4d.h>
 
+#include <gal/graphics_abstraction_layer.h>
 #include <geometry/shape_rect.h>
 #include <geometry/shape_simple.h>
 #include <pcb_painter.h>
diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp
index 7becf9cd69..54abe993d5 100644
--- a/pcbnew/router/router_tool.cpp
+++ b/pcbnew/router/router_tool.cpp
@@ -47,6 +47,7 @@ using namespace std::placeholders;
 #include <connectivity/connectivity_data.h>
 #include <connectivity/connectivity_algo.h>
 #include <confirm.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <bitmaps.h>
 #include <string_utils.h>
 #include <gal/painter.h>
diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp
index 0ef2137bdb..b10f2182a2 100644
--- a/pcbnew/tools/drawing_tool.cpp
+++ b/pcbnew/tools/drawing_tool.cpp
@@ -32,6 +32,7 @@
 #include <footprint_editor_settings.h>
 #include <dialogs/dialog_text_properties.h>
 #include <dialogs/dialog_track_via_size.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <geometry/geometry_utils.h>
 #include <geometry/shape_segment.h>
 #include <import_gfx/dialog_import_gfx.h>
diff --git a/pcbnew/tools/drawing_tool.h b/pcbnew/tools/drawing_tool.h
index 628505d181..883956ba43 100644
--- a/pcbnew/tools/drawing_tool.h
+++ b/pcbnew/tools/drawing_tool.h
@@ -27,6 +27,7 @@
 #ifndef __DRAWING_TOOL_H
 #define __DRAWING_TOOL_H
 
+#include <stack>
 #include <optional>
 #include <tool/tool_menu.h>
 #include <tools/pcb_tool_base.h>
diff --git a/pcbnew/tools/edit_tool_move_fct.cpp b/pcbnew/tools/edit_tool_move_fct.cpp
index f488be395f..b17fca9a15 100644
--- a/pcbnew/tools/edit_tool_move_fct.cpp
+++ b/pcbnew/tools/edit_tool_move_fct.cpp
@@ -29,6 +29,7 @@
 #include <kiplatform/ui.h>
 #include <board.h>
 #include <board_commit.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <pad.h>
 #include <pcb_group.h>
 #include <pcb_edit_frame.h>
diff --git a/pcbnew/tools/pcb_control.cpp b/pcbnew/tools/pcb_control.cpp
index b0f437a604..5848ebb987 100644
--- a/pcbnew/tools/pcb_control.cpp
+++ b/pcbnew/tools/pcb_control.cpp
@@ -40,6 +40,7 @@
 #include <board_item.h>
 #include <dialogs/dialog_paste_special.h>
 #include <pcb_dimension.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <footprint.h>
 #include <pcb_group.h>
 #include <pcb_textbox.h>
diff --git a/pcbnew/tools/pcb_grid_helper.cpp b/pcbnew/tools/pcb_grid_helper.cpp
index 2914339bc3..60a497ea3f 100644
--- a/pcbnew/tools/pcb_grid_helper.cpp
+++ b/pcbnew/tools/pcb_grid_helper.cpp
@@ -34,6 +34,7 @@
 #include <pcb_group.h>
 #include <pcb_track.h>
 #include <zone.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <geometry/oval.h>
 #include <geometry/shape_circle.h>
 #include <geometry/shape_line_chain.h>
diff --git a/pcbnew/tools/pcb_picker_tool.cpp b/pcbnew/tools/pcb_picker_tool.cpp
index fdeb3a3ae0..1cee0f8a9b 100644
--- a/pcbnew/tools/pcb_picker_tool.cpp
+++ b/pcbnew/tools/pcb_picker_tool.cpp
@@ -26,6 +26,7 @@
 #include "pcb_picker_tool.h"
 #include "pcb_actions.h"
 #include "pcb_grid_helper.h"
+#include <gal/graphics_abstraction_layer.h>
 #include <view/view_controls.h>
 #include <tools/zone_filler_tool.h>
 
diff --git a/pcbnew/tools/pcb_point_editor.cpp b/pcbnew/tools/pcb_point_editor.cpp
index 04d70c5e36..a96b464e3d 100644
--- a/pcbnew/tools/pcb_point_editor.cpp
+++ b/pcbnew/tools/pcb_point_editor.cpp
@@ -30,6 +30,7 @@ using namespace std::placeholders;
 #include <advanced_config.h>
 #include <tool/tool_manager.h>
 #include <view/view_controls.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <geometry/seg.h>
 #include <confirm.h>
 #include <tools/pcb_actions.h>
diff --git a/pcbnew/tools/pcb_tool_base.cpp b/pcbnew/tools/pcb_tool_base.cpp
index 831d335b49..d6e952628c 100644
--- a/pcbnew/tools/pcb_tool_base.cpp
+++ b/pcbnew/tools/pcb_tool_base.cpp
@@ -25,6 +25,7 @@
 
 #include <tool/tool_manager.h>
 #include <board_commit.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <footprint.h>
 #include <pcb_draw_panel_gal.h>
 #include <pgm_base.h>
diff --git a/pcbnew/tools/pcb_viewer_tools.cpp b/pcbnew/tools/pcb_viewer_tools.cpp
index 630cbcc8ff..fc28004bd1 100644
--- a/pcbnew/tools/pcb_viewer_tools.cpp
+++ b/pcbnew/tools/pcb_viewer_tools.cpp
@@ -26,6 +26,7 @@
 #include <pcbnew_settings.h>
 #include <footprint_editor_settings.h>
 #include <3d_viewer/eda_3d_viewer_frame.h>
+#include <gal/graphics_abstraction_layer.h>
 #include <kiplatform/ui.h>
 #include <pcb_base_frame.h>
 #include <preview_items/ruler_item.h>
diff --git a/qa/qa_utils/pcb_test_frame.h b/qa/qa_utils/pcb_test_frame.h
index cae3ec1bd3..19a61a2513 100644
--- a/qa/qa_utils/pcb_test_frame.h
+++ b/qa/qa_utils/pcb_test_frame.h
@@ -31,6 +31,7 @@
 #include <memory>
 
 #include <pcb_draw_panel_gal.h>
+#include <gal/graphics_abstraction_layer.h>
 
 using std::unique_ptr;