diff --git a/3d-viewer/3d_canvas/create_layer_items.cpp b/3d-viewer/3d_canvas/create_layer_items.cpp
index dcd902d029..23eba48f8a 100644
--- a/3d-viewer/3d_canvas/create_layer_items.cpp
+++ b/3d-viewer/3d_canvas/create_layer_items.cpp
@@ -45,6 +45,7 @@
 #include <trigo.h>
 #include <vector>
 #include <thread>
+#include <core/arraydim.h>
 #include <algorithm>
 #include <atomic>
 
diff --git a/3d-viewer/3d_viewer/eda_3d_viewer.cpp b/3d-viewer/3d_viewer/eda_3d_viewer.cpp
index d1c188aa79..99b2e8d50d 100644
--- a/3d-viewer/3d_viewer/eda_3d_viewer.cpp
+++ b/3d-viewer/3d_viewer/eda_3d_viewer.cpp
@@ -39,6 +39,7 @@
 #include <board_stackup_manager/class_board_stackup.h>
 #include <board_stackup_manager/stackup_predefined_prms.h>
 #include <board.h>
+#include <core/arraydim.h>
 #include <layers_id_colors_and_visibility.h>
 #include <gal/dpi_scaling.h>
 #include <pgm_base.h>
diff --git a/3d-viewer/common_ogl/cogl_att_list.cpp b/3d-viewer/common_ogl/cogl_att_list.cpp
index 52ee9994d0..db48a41621 100644
--- a/3d-viewer/common_ogl/cogl_att_list.cpp
+++ b/3d-viewer/common_ogl/cogl_att_list.cpp
@@ -28,9 +28,9 @@
  */
 
 #include "cogl_att_list.h"
-#include <macros.h>
 #include <wx/glcanvas.h>
 #include <wx/debug.h>
+#include <core/arraydim.h>
 
 /**
  *  Attributes list to be passed to a wxGLCanvas creation.
diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp
index 6cef34f999..0cc6977c0f 100644
--- a/common/dialogs/dialog_page_settings.cpp
+++ b/common/dialogs/dialog_page_settings.cpp
@@ -23,6 +23,7 @@
 
 #include <base_screen.h>
 #include <confirm.h>
+#include <core/arraydim.h>
 #include <dialog_page_settings.h>
 #include <eda_draw_frame.h>
 #include <eda_item.h>
diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp
index f644d7a139..c7f9d69008 100644
--- a/common/eda_draw_frame.cpp
+++ b/common/eda_draw_frame.cpp
@@ -26,6 +26,7 @@
 #include <base_screen.h>
 #include <bitmaps.h>
 #include <confirm.h>
+#include <core/arraydim.h>
 #include <dialog_shim.h>
 #include <eda_draw_frame.h>
 #include <filehistory.h>
diff --git a/common/gestfich.cpp b/common/gestfich.cpp
index ddcc6f9155..d349d7f3c4 100644
--- a/common/gestfich.cpp
+++ b/common/gestfich.cpp
@@ -36,6 +36,7 @@
 #include <pgm_base.h>
 #include <common.h>
 #include <confirm.h>
+#include <core/arraydim.h>
 #include <gestfich.h>
 
 void AddDelimiterString( wxString& string )
diff --git a/common/kiway.cpp b/common/kiway.cpp
index c4696a8355..2a9b7cf19f 100644
--- a/common/kiway.cpp
+++ b/common/kiway.cpp
@@ -30,6 +30,7 @@
 #include <kiway_express.h>
 #include <pgm_base.h>
 #include <config.h>
+#include <core/arraydim.h>
 #include <id.h>
 #include <settings/settings_manager.h>
 #include <logging.h>
diff --git a/common/lset.cpp b/common/lset.cpp
index 70f5e66bfb..52b964ce1c 100644
--- a/common/lset.cpp
+++ b/common/lset.cpp
@@ -28,6 +28,7 @@
 #include <iostream>                           // for string, endl, basic_ost...
 #include <stddef.h>                           // for size_t
 
+#include <core/arraydim.h>
 #include <math/util.h>                        // for Clamp
 #include <layers_id_colors_and_visibility.h>  // for LSET, PCB_LAYER_ID, LSEQ
 #include <macros.h>                           // for arrayDim
diff --git a/common/marker_base.cpp b/common/marker_base.cpp
index cbc56fa82a..3f41c8f3bc 100644
--- a/common/marker_base.cpp
+++ b/common/marker_base.cpp
@@ -32,6 +32,7 @@
 
 #include "base_screen.h"
 #include "marker_base.h"
+#include <core/arraydim.h>
 #include <geometry/shape_line_chain.h>
 #include <render_settings.h>
 #include "dialog_display_info_HTML_base.h"
diff --git a/common/pgm_base.cpp b/common/pgm_base.cpp
index 5fab1e0304..c698e17406 100644
--- a/common/pgm_base.cpp
+++ b/common/pgm_base.cpp
@@ -43,6 +43,7 @@
 #include <build_version.h>
 #include <config_params.h>
 #include <confirm.h>
+#include <core/arraydim.h>
 #include <dialogs/dialog_configure_paths.h>
 #include <eda_base_frame.h>
 #include <eda_draw_frame.h>
diff --git a/common/project.cpp b/common/project.cpp
index 976d8e3a28..bb19a9f3ec 100644
--- a/common/project.cpp
+++ b/common/project.cpp
@@ -25,6 +25,7 @@
 
 #include <config_params.h>
 #include <confirm.h>
+#include <core/arraydim.h>
 #include <fp_lib_table.h>
 #include <kicad_string.h>
 #include <kiface_ids.h>
diff --git a/common/project/project_archiver.cpp b/common/project/project_archiver.cpp
index c2c736ef56..1d7440e5fe 100644
--- a/common/project/project_archiver.cpp
+++ b/common/project/project_archiver.cpp
@@ -24,6 +24,7 @@
 #include <wx/wfstream.h>
 #include <wx/zipstrm.h>
 
+#include <core/arraydim.h>
 #include <macros.h>
 #include <project/project_archiver.h>
 #include <reporter.h>
diff --git a/common/tool/tool_dispatcher.cpp b/common/tool/tool_dispatcher.cpp
index 6e1a5e849b..90a2c31499 100644
--- a/common/tool/tool_dispatcher.cpp
+++ b/common/tool/tool_dispatcher.cpp
@@ -38,6 +38,7 @@
 #include <class_draw_panel_gal.h>
 #include <eda_draw_frame.h>
 
+#include <core/arraydim.h>
 #include <core/optional.h>
 #include <wx/stc/stc.h>
 #include <kiplatform/app.h>
diff --git a/eeschema/autoplace_fields.cpp b/eeschema/autoplace_fields.cpp
index a6c59699a0..5f2191f491 100644
--- a/eeschema/autoplace_fields.cpp
+++ b/eeschema/autoplace_fields.cpp
@@ -66,6 +66,7 @@
 #include <tool/tool_manager.h>
 #include <tools/ee_selection_tool.h>
 #include <eeschema_settings.h>
+#include <core/arraydim.h>
 
 #define FIELD_PADDING Mils2iu( 10 )            // arbitrarily chosen for aesthetics
 #define FIELD_PADDING_ALIGNED Mils2iu( 18 )    // aligns 50 mil text to a 100 mil grid
diff --git a/eeschema/pin_type.cpp b/eeschema/pin_type.cpp
index 8781884a10..8319e15241 100644
--- a/eeschema/pin_type.cpp
+++ b/eeschema/pin_type.cpp
@@ -24,7 +24,7 @@
 #include <pin_type.h>
 #include <lib_pin.h>
 #include <base_units.h>
-#include <macros.h>
+#include <core/arraydim.h>
 
 
 // These are true singletons so it's OK for them to be globals.
diff --git a/eeschema/sch_bitmap.cpp b/eeschema/sch_bitmap.cpp
index e3847401ce..68da3be63f 100644
--- a/eeschema/sch_bitmap.cpp
+++ b/eeschema/sch_bitmap.cpp
@@ -33,7 +33,7 @@
 #include <base_units.h>
 #include <common.h>
 #include <eda_draw_frame.h>
-#include <macros.h>
+#include <core/mirror.h>
 #include <sch_bitmap.h>
 #include <trigo.h>
 
diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp
index 01091d2d62..e41535ed29 100644
--- a/eeschema/sch_bus_entry.cpp
+++ b/eeschema/sch_bus_entry.cpp
@@ -24,6 +24,7 @@
 
 #include <sch_draw_panel.h>
 #include <bitmaps.h>
+#include <core/mirror.h>
 #include <schematic.h>
 #include <sch_bus_entry.h>
 #include <sch_edit_frame.h>
diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp
index 2a0041e388..ab96596b71 100644
--- a/eeschema/sch_component.cpp
+++ b/eeschema/sch_component.cpp
@@ -25,6 +25,7 @@
 #include <sch_edit_frame.h>
 #include <widgets/msgpanel.h>
 #include <bitmaps.h>
+#include <core/mirror.h>
 #include <lib_rectangle.h>
 #include <lib_pin.h>
 #include <lib_text.h>
diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp
index 360bdcd312..00b7b64aa9 100644
--- a/eeschema/sch_field.cpp
+++ b/eeschema/sch_field.cpp
@@ -37,6 +37,7 @@
 #include <sch_edit_frame.h>
 #include <plotter.h>
 #include <bitmaps.h>
+#include <core/mirror.h>
 #include <kiway.h>
 #include <general.h>
 #include <class_library.h>
diff --git a/eeschema/sch_junction.cpp b/eeschema/sch_junction.cpp
index 99a2ce0285..5c9661580d 100644
--- a/eeschema/sch_junction.cpp
+++ b/eeschema/sch_junction.cpp
@@ -31,7 +31,7 @@
 #include <common.h>
 #include <plotter.h>
 #include <bitmaps.h>
-#include <macros.h>
+#include <core/mirror.h>
 #include <geometry/shape_rect.h>
 #include <sch_painter.h>
 #include <sch_junction.h>
diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp
index 105921fb04..c7c063a11c 100644
--- a/eeschema/sch_line.cpp
+++ b/eeschema/sch_line.cpp
@@ -22,6 +22,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
  */
 
+#include <core/mirror.h>
 #include <sch_painter.h>
 #include <plotter.h>
 #include <sch_line.h>
diff --git a/eeschema/sch_no_connect.cpp b/eeschema/sch_no_connect.cpp
index 6631f47b04..c64b399ac5 100644
--- a/eeschema/sch_no_connect.cpp
+++ b/eeschema/sch_no_connect.cpp
@@ -34,7 +34,7 @@
 #include <sch_no_connect.h>
 #include <settings/color_settings.h>
 #include <default_values.h>    // For some default values
-#include <macros.h>
+#include <core/mirror.h>
 #include <trigo.h>
 
 
diff --git a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp
index e35d42b414..901b29f812 100644
--- a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp
+++ b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp
@@ -25,6 +25,7 @@
 
 #include <sch_plugins/cadstar/cadstar_sch_archive_loader.h>
 
+#include <core/mirror.h>
 #include <eda_text.h>
 #include <lib_arc.h>
 #include <lib_polyline.h>
diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp
index 497c0d1a86..72ad6104e8 100644
--- a/eeschema/sch_sheet.cpp
+++ b/eeschema/sch_sheet.cpp
@@ -22,6 +22,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
  */
 
+#include <core/mirror.h>
 #include <sch_draw_panel.h>
 #include <gr_text.h>
 #include <trigo.h>
diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp
index 8b1e88554c..635e857d98 100644
--- a/eeschema/sch_text.cpp
+++ b/eeschema/sch_text.cpp
@@ -44,6 +44,7 @@
 #include <dialogs/html_messagebox.h>
 #include <project/project_file.h>
 #include <project/net_settings.h>
+#include <core/mirror.h>
 #include <dialog_helpers.h>
 #include <trigo.h>
 
diff --git a/gerbview/dialogs/panel_gerbview_settings.cpp b/gerbview/dialogs/panel_gerbview_settings.cpp
index 8449f576d2..32dbd25c76 100644
--- a/gerbview/dialogs/panel_gerbview_settings.cpp
+++ b/gerbview/dialogs/panel_gerbview_settings.cpp
@@ -18,10 +18,9 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-
 #include <gerbview.h>
 #include <gerbview_frame.h>
-#include <macros.h>
+#include <core/arraydim.h>
 
 #include "panel_gerbview_settings.h"
 
diff --git a/gerbview/gerber_file_image.cpp b/gerbview/gerber_file_image.cpp
index ad54518885..6168ef9157 100644
--- a/gerbview/gerber_file_image.cpp
+++ b/gerbview/gerber_file_image.cpp
@@ -35,6 +35,7 @@
 #include <X2_gerber_attributes.h>
 #include <algorithm>
 #include <map>
+#include <core/arraydim.h>
 
 
 /**
diff --git a/gerbview/widgets/gerbview_layer_widget.cpp b/gerbview/widgets/gerbview_layer_widget.cpp
index 14de535547..038274e2dc 100644
--- a/gerbview/widgets/gerbview_layer_widget.cpp
+++ b/gerbview/widgets/gerbview_layer_widget.cpp
@@ -27,6 +27,7 @@
 #include <gerbview.h>
 #include <gerbview_frame.h>
 #include <gerber_file_image_list.h>
+#include <core/arraydim.h>
 #include <view/view.h>
 #include <gerbview_painter.h>
 #include <gal/graphics_abstraction_layer.h>
diff --git a/include/core/arraydim.h b/include/core/arraydim.h
new file mode 100644
index 0000000000..5d7f4c7e70
--- /dev/null
+++ b/include/core/arraydim.h
@@ -0,0 +1,34 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2020 KiCad Developers, see CHANGELOG.TXT for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-3.0.html
+ * or you may search the http://www.gnu.org website for the version 3 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+
+#ifndef ARRAYDIM_H
+#define ARRAYDIM_H
+
+/// # of elements in an array.  This implements type-safe compile time checking
+template <typename T, std::size_t N>
+constexpr std::size_t arrayDim( T const ( & )[N] ) noexcept
+{
+    return N;
+}
+
+#endif /* ARRAYDIM_H */
diff --git a/include/core/mirror.h b/include/core/mirror.h
new file mode 100644
index 0000000000..b463bf15f6
--- /dev/null
+++ b/include/core/mirror.h
@@ -0,0 +1,47 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2020 KiCad Developers, see CHANGELOG.TXT for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/old-licenses/gpl-3.0.html
+ * or you may search the http://www.gnu.org website for the version 3 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+
+#ifndef MIRROR_H
+#define MIRROR_H
+
+/**
+ * Function MIRRORVAL
+ * Mirror @a aPoint in @a aMirrorRef.
+ */
+template <typename T>
+T MIRRORVAL( T aPoint, T aMirrorRef )
+{
+    return -( aPoint - aMirrorRef ) + aMirrorRef;
+}
+
+/**
+ * Function MIRROR
+ * Mirror @a aPoint in @a aMirrorRef.
+ */
+template <typename T>
+void MIRROR( T& aPoint, const T& aMirrorRef )
+{
+    aPoint = MIRRORVAL( aPoint, aMirrorRef );
+}
+
+#endif /* MIRROR_H */
diff --git a/include/macros.h b/include/macros.h
index 86b8425a78..b2823d1deb 100644
--- a/include/macros.h
+++ b/include/macros.h
@@ -116,26 +116,4 @@ static inline wxString FROM_UTF8( const char* cstring )
     return line;
 }
 
-/// # of elements in an array.  This implements type-safe compile time checking
-template <typename T, std::size_t N>
-constexpr std::size_t arrayDim(T const (&)[N]) noexcept
-{
-    return N;
-}
-
-/**
- * Function MIRROR
- * Mirror @a aPoint in @a aMirrorRef.
- */
-template<typename T>
-T MIRRORVAL( T aPoint, T aMirrorRef )
-{
-    return -( aPoint - aMirrorRef ) + aMirrorRef;
-}
-template<typename T>
-void MIRROR( T& aPoint, const T& aMirrorRef )
-{
-    aPoint = MIRRORVAL( aPoint, aMirrorRef );
-}
-
 #endif // MACROS_H
diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp
index 2c1a0aa2db..b0d36033e3 100644
--- a/pagelayout_editor/pl_editor_frame.cpp
+++ b/pagelayout_editor/pl_editor_frame.cpp
@@ -26,6 +26,7 @@
 #include <kiface_i.h>
 #include <pgm_base.h>
 #include <bitmaps.h>
+#include <core/arraydim.h>
 #include <eda_item.h>
 #include <page_layout/ws_data_item.h>
 #include <page_layout/ws_data_model.h>
diff --git a/pcbnew/board.cpp b/pcbnew/board.cpp
index f60632de98..08bfd5ae4c 100644
--- a/pcbnew/board.cpp
+++ b/pcbnew/board.cpp
@@ -37,6 +37,7 @@
 #include <zone.h>
 #include <pcb_marker.h>
 #include <pcb_target.h>
+#include <core/arraydim.h>
 #include <core/kicad_algo.h>
 #include <connectivity/connectivity_data.h>
 #include <kicad_string.h>
diff --git a/pcbnew/board_stackup_manager/dielectric_material.cpp b/pcbnew/board_stackup_manager/dielectric_material.cpp
index b3392ac0b9..3d11a80269 100644
--- a/pcbnew/board_stackup_manager/dielectric_material.cpp
+++ b/pcbnew/board_stackup_manager/dielectric_material.cpp
@@ -27,9 +27,9 @@
  * @file dielectric_material.cpp
  */
 
-#include <macros.h>
 #include "stackup_predefined_prms.h"
 #include "dielectric_material.h"
+#include <core/arraydim.h>
 
 
 // A list of available substrate material
diff --git a/pcbnew/board_stackup_manager/stackup_predefined_prms.cpp b/pcbnew/board_stackup_manager/stackup_predefined_prms.cpp
index dc9f4b7bfd..fe34d862c3 100644
--- a/pcbnew/board_stackup_manager/stackup_predefined_prms.cpp
+++ b/pcbnew/board_stackup_manager/stackup_predefined_prms.cpp
@@ -29,6 +29,7 @@
 
 #include "class_board_stackup.h"
 #include <convert_to_biu.h>
+#include <core/arraydim.h>
 #include <layers_id_colors_and_visibility.h>
 #include <board_design_settings.h>
 #include <i18n_utility.h>       // _HKI definition
diff --git a/pcbnew/dialogs/dialog_export_svg.cpp b/pcbnew/dialogs/dialog_export_svg.cpp
index ea47276b9f..072c746601 100644
--- a/pcbnew/dialogs/dialog_export_svg.cpp
+++ b/pcbnew/dialogs/dialog_export_svg.cpp
@@ -28,6 +28,7 @@
 #include <wildcards_and_files_ext.h>
 #include <reporter.h>
 #include <confirm.h>
+#include <core/arraydim.h>
 #include <core/kicad_algo.h>
 #include <pcbplot.h>
 #include <locale_io.h>
diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp
index cd6207b99a..0effb9ec9b 100644
--- a/pcbnew/dialogs/dialog_gendrill.cpp
+++ b/pcbnew/dialogs/dialog_gendrill.cpp
@@ -23,6 +23,7 @@
  */
 
 #include <confirm.h>
+#include <core/arraydim.h>
 #include <pcb_edit_frame.h>
 #include <pcbnew_settings.h>
 #include <pcbplot.h>
diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp
index 208f32b96b..fbb5d9be81 100644
--- a/pcbnew/dialogs/dialog_pad_properties.cpp
+++ b/pcbnew/dialogs/dialog_pad_properties.cpp
@@ -30,6 +30,7 @@
 #include <board.h>
 #include <footprint.h>
 #include <confirm.h>
+#include <core/arraydim.h>
 #include <convert_basic_shapes_to_polygon.h> // for enum RECT_CHAMFER_POSITIONS definition
 #include <geometry/shape_segment.h>
 #include <dialog_pad_properties.h>
diff --git a/pcbnew/dialogs/dialog_print_pcbnew.cpp b/pcbnew/dialogs/dialog_print_pcbnew.cpp
index 8f6b814d11..0ec0bea2e1 100644
--- a/pcbnew/dialogs/dialog_print_pcbnew.cpp
+++ b/pcbnew/dialogs/dialog_print_pcbnew.cpp
@@ -26,6 +26,7 @@
 
 #include <kiface_i.h>
 #include <confirm.h>
+#include <core/arraydim.h>
 #include <base_units.h>
 #include <pcbnew_settings.h>
 #include <pcbplot.h>
diff --git a/pcbnew/dialogs/panel_setup_layers.cpp b/pcbnew/dialogs/panel_setup_layers.cpp
index 97f5631e2b..96fdd59a5e 100644
--- a/pcbnew/dialogs/panel_setup_layers.cpp
+++ b/pcbnew/dialogs/panel_setup_layers.cpp
@@ -25,6 +25,7 @@
 
 
 #include <confirm.h>
+#include <core/arraydim.h>
 #include <core/kicad_algo.h>
 #include <pcbnew.h>
 #include <pcb_edit_frame.h>
diff --git a/pcbnew/exporters/export_gencad.cpp b/pcbnew/exporters/export_gencad.cpp
index 320844da51..e1e1b095c8 100644
--- a/pcbnew/exporters/export_gencad.cpp
+++ b/pcbnew/exporters/export_gencad.cpp
@@ -35,6 +35,7 @@
 #include <footprint.h>
 #include <track.h>
 #include <confirm.h>
+#include <core/arraydim.h>
 #include <dialogs/dialog_gencad_export_options.h>
 #include <locale_io.h>
 #include <hash_eda.h>
diff --git a/pcbnew/exporters/export_vrml.cpp b/pcbnew/exporters/export_vrml.cpp
index 2255c0ffb5..02d97eba64 100644
--- a/pcbnew/exporters/export_vrml.cpp
+++ b/pcbnew/exporters/export_vrml.cpp
@@ -39,6 +39,7 @@
 #include "track.h"
 #include "zone.h"
 #include "convert_to_biu.h"
+#include <core/arraydim.h>
 #include <filename_resolver.h>
 #include "plugins/3dapi/ifsg_all.h"
 #include "streamwrapper.h"
diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp
index abb48d446f..6c76061eb4 100644
--- a/pcbnew/files.cpp
+++ b/pcbnew/files.cpp
@@ -24,6 +24,7 @@
  */
 
 #include <confirm.h>
+#include <core/arraydim.h>
 #include <kicad_string.h>
 #include <gestfich.h>
 #include <pcb_edit_frame.h>
diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp
index 3a26f8b607..dd46ed1238 100644
--- a/pcbnew/footprint.cpp
+++ b/pcbnew/footprint.cpp
@@ -24,6 +24,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
  */
 
+#include <core/mirror.h>
 #include <confirm.h>
 #include <refdes_utils.h>
 #include <bitmaps.h>
diff --git a/pcbnew/fp_shape.cpp b/pcbnew/fp_shape.cpp
index a5f3e574c0..0d14c3784d 100644
--- a/pcbnew/fp_shape.cpp
+++ b/pcbnew/fp_shape.cpp
@@ -25,6 +25,7 @@
  */
 
 #include <bitmaps.h>
+#include <core/mirror.h>
 #include <math/util.h>      // for KiROUND
 #include <settings/color_settings.h>
 #include <settings/settings_manager.h>
diff --git a/pcbnew/fp_text.cpp b/pcbnew/fp_text.cpp
index 65d819a547..7719317add 100644
--- a/pcbnew/fp_text.cpp
+++ b/pcbnew/fp_text.cpp
@@ -27,6 +27,7 @@
 #include <base_units.h>
 #include <bitmaps.h>
 #include <board.h>
+#include <core/mirror.h>
 #include <footprint.h>
 #include <settings/settings_manager.h>
 #include <trigo.h>
diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp
index 1e7d869c83..f49dba5978 100644
--- a/pcbnew/pad.cpp
+++ b/pcbnew/pad.cpp
@@ -25,6 +25,7 @@
 
 #include <base_units.h>
 #include <bitmaps.h>
+#include <core/mirror.h>
 #include <math/util.h>      // for KiROUND
 #include <eda_draw_frame.h>
 #include <geometry/shape_circle.h>
diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp
index a7c5f73a5d..7a4b5cdecb 100644
--- a/pcbnew/pcb_painter.cpp
+++ b/pcbnew/pcb_painter.cpp
@@ -35,6 +35,7 @@
 #include <pcb_marker.h>
 #include <dimension.h>
 #include <pcb_target.h>
+#include <core/arraydim.h>
 
 #include <layers_id_colors_and_visibility.h>
 #include <pcb_painter.h>
@@ -1668,7 +1669,7 @@ void PCB_PAINTER::draw( const PCB_MARKER* aMarker, int aLayer )
         m_gal->SetFillColor( color );
         m_gal->SetIsFill( true );
     }
-   
+
     m_gal->DrawPolygon( polygon );
     m_gal->Restore();
 }
diff --git a/pcbnew/pcb_text.cpp b/pcbnew/pcb_text.cpp
index 8f8c47f439..83ded2ebd5 100644
--- a/pcbnew/pcb_text.cpp
+++ b/pcbnew/pcb_text.cpp
@@ -28,6 +28,7 @@
 #include <base_units.h>
 #include <bitmaps.h>
 #include <board.h>
+#include <core/mirror.h>
 #include <pcb_text.h>
 #include <pcb_painter.h>
 #include <trigo.h>
diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp
index df75c0fbad..d841e207e1 100644
--- a/pcbnew/plot_board_layers.cpp
+++ b/pcbnew/plot_board_layers.cpp
@@ -36,6 +36,7 @@
 #include <math/util.h>      // for KiROUND
 
 #include <board.h>
+#include <core/arraydim.h>
 #include <footprint.h>
 #include <track.h>
 #include <fp_shape.h>
diff --git a/pcbnew/plugins/eagle/eagle_plugin.cpp b/pcbnew/plugins/eagle/eagle_plugin.cpp
index 4a3ba92969..46a4d506d0 100644
--- a/pcbnew/plugins/eagle/eagle_plugin.cpp
+++ b/pcbnew/plugins/eagle/eagle_plugin.cpp
@@ -57,6 +57,7 @@ Load() TODO's
 #include <wx/filename.h>
 
 #include <convert_basic_shapes_to_polygon.h>
+#include <core/arraydim.h>
 #include <geometry/geometry_utils.h>
 #include <kicad_string.h>
 #include <locale_io.h>
diff --git a/pcbnew/plugins/kicad/kicad_plugin.cpp b/pcbnew/plugins/kicad/kicad_plugin.cpp
index 0bfd18c08f..5ddc2c9cb4 100644
--- a/pcbnew/plugins/kicad/kicad_plugin.cpp
+++ b/pcbnew/plugins/kicad/kicad_plugin.cpp
@@ -37,6 +37,7 @@
 #include <pcb_target.h>
 #include <fp_shape.h>
 #include <confirm.h>
+#include <core/arraydim.h>
 #include <locale_io.h>
 #include <zones.h>
 #include <plugins/kicad/kicad_plugin.h>
diff --git a/pcbnew/zone.cpp b/pcbnew/zone.cpp
index 1d2ac62093..7605d2ad19 100644
--- a/pcbnew/zone.cpp
+++ b/pcbnew/zone.cpp
@@ -26,6 +26,7 @@
 #include <bitmaps.h>
 #include <geometry/geometry_utils.h>
 #include <geometry/shape_null.h>
+#include <core/mirror.h>
 #include <advanced_config.h>
 #include <pcb_edit_frame.h>
 #include <pcb_screen.h>