← Back to team overview

kicad-developers team mailing list archive

[PATCH 02/12] Add missing C++ stdlib headers

 

The GCC standard library headers often include other headers, which makes
some code compile that forgets to include several headers.
---
 common/gal/graphics_abstraction_layer.cpp      | 2 ++
 common/grid_tricks.cpp                         | 2 ++
 common/selcolor.cpp                            | 2 ++
 common/tool/action_manager.cpp                 | 1 +
 eeschema/class_library.h                       | 2 ++
 eeschema/dialogs/dialog_lib_edit_pin_table.cpp | 2 ++
 eeschema/sch_sheet_path.h                      | 2 ++
 gerbview/class_gerber_file_image.cpp           | 1 +
 gerbview/class_gerber_file_image_list.cpp      | 2 ++
 include/tool/tool_event.h                      | 1 +
 include/tool/tool_manager.h                    | 1 +
 pcb_calculator/transline/transline.cpp         | 1 +
 pcbnew/layer_widget.cpp                        | 3 +++
 pcbnew/ratsnest_data.h                         | 2 ++
 pcbnew/router/pns_diff_pair.cpp                | 1 +
 pcbnew/router/pns_optimizer.cpp                | 2 ++
 pcbnew/router/pns_utils.cpp                    | 2 ++
 pcbnew/tools/conditional_menu.h                | 1 +
 pcbnew/tools/edit_points.h                     | 3 +++
 polygon/math_for_graphics.cpp                  | 1 +
 utils/idftools/idf_common.cpp                  | 1 +
 21 files changed, 35 insertions(+)

diff --git a/common/gal/graphics_abstraction_layer.cpp b/common/gal/graphics_abstraction_layer.cpp
index b77ad4f..b5847fc 100644
--- a/common/gal/graphics_abstraction_layer.cpp
+++ b/common/gal/graphics_abstraction_layer.cpp
@@ -29,6 +29,8 @@
 #include <gal/graphics_abstraction_layer.h>
 #include <gal/definitions.h>
 
+#include <cmath>
+
 using namespace KIGFX;
 
 
diff --git a/common/grid_tricks.cpp b/common/grid_tricks.cpp
index c854411..3782786 100644
--- a/common/grid_tricks.cpp
+++ b/common/grid_tricks.cpp
@@ -29,6 +29,8 @@
 #include <wx/arrstr.h>
 #include <wx/clipbrd.h>
 
+#include <algorithm>
+
 
  // It works for table data on clipboard for an Excell spreadsheet,
 // why not us too for now.
diff --git a/common/selcolor.cpp b/common/selcolor.cpp
index 0f5d229..fb96bcc 100644
--- a/common/selcolor.cpp
+++ b/common/selcolor.cpp
@@ -32,6 +32,8 @@
 
 #include <wx/statline.h>
 
+#include <algorithm>
+
 
 enum colors_id {
     ID_COLOR_BLACK = 2000 // colors_id = ID_COLOR_BLACK a ID_COLOR_BLACK + NBCOLORS-1
diff --git a/common/tool/action_manager.cpp b/common/tool/action_manager.cpp
index ddc3cea..fcf2006 100644
--- a/common/tool/action_manager.cpp
+++ b/common/tool/action_manager.cpp
@@ -30,6 +30,7 @@
 #include <hotkeys_basic.h>
 #include <boost/foreach.hpp>
 #include <boost/range/adaptor/map.hpp>
+#include <cctype>
 #include <cassert>
 
 ACTION_MANAGER::ACTION_MANAGER( TOOL_MANAGER* aToolManager ) :
diff --git a/eeschema/class_library.h b/eeschema/class_library.h
index 37bf0dd..355cab0 100644
--- a/eeschema/class_library.h
+++ b/eeschema/class_library.h
@@ -37,6 +37,8 @@
 
 #include <project.h>
 
+#include <map>
+
 class LINE_READER;
 class OUTPUTFORMATTER;
 
diff --git a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp
index 047f737..c652bd7 100644
--- a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp
+++ b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp
@@ -27,6 +27,8 @@
 
 #include <boost/algorithm/string/join.hpp>
 #include <queue>
+#include <list>
+#include <map>
 
 /* Avoid wxWidgets bug #16906 -- http://trac.wxwidgets.org/ticket/16906
  *
diff --git a/eeschema/sch_sheet_path.h b/eeschema/sch_sheet_path.h
index 3e9f9b9..a7427a5 100644
--- a/eeschema/sch_sheet_path.h
+++ b/eeschema/sch_sheet_path.h
@@ -33,6 +33,8 @@
 
 #include <base_struct.h>
 
+#include <map>
+
 
 /** Info about complex hierarchies handling:
  * A hierarchical schematic uses sheets (hierarchical sheets) included in a
diff --git a/gerbview/class_gerber_file_image.cpp b/gerbview/class_gerber_file_image.cpp
index 48b7950..a196006 100644
--- a/gerbview/class_gerber_file_image.cpp
+++ b/gerbview/class_gerber_file_image.cpp
@@ -38,6 +38,7 @@
 #include <class_X2_gerber_attributes.h>
 
 #include <algorithm>
+#include <map>
 
 
 /**
diff --git a/gerbview/class_gerber_file_image_list.cpp b/gerbview/class_gerber_file_image_list.cpp
index df129b9..fb68710 100644
--- a/gerbview/class_gerber_file_image_list.cpp
+++ b/gerbview/class_gerber_file_image_list.cpp
@@ -35,6 +35,8 @@
 #include <class_gerber_file_image_list.h>
 #include <class_X2_gerber_attributes.h>
 
+#include <map>
+
 
 // GERBER_FILE_IMAGE_LIST is a helper class to handle a list of GERBER_FILE_IMAGE files
 GERBER_FILE_IMAGE_LIST::GERBER_FILE_IMAGE_LIST()
diff --git a/include/tool/tool_event.h b/include/tool/tool_event.h
index 4def191..cd64c67 100644
--- a/include/tool/tool_event.h
+++ b/include/tool/tool_event.h
@@ -27,6 +27,7 @@
 
 #include <cstdio>
 #include <deque>
+#include <iterator>
 
 #include <math/vector2d.h>
 #include <cassert>
diff --git a/include/tool/tool_manager.h b/include/tool/tool_manager.h
index 76127ff..4703f63 100644
--- a/include/tool/tool_manager.h
+++ b/include/tool/tool_manager.h
@@ -29,6 +29,7 @@
 #include <deque>
 #include <typeinfo>
 #include <map>
+#include <list>
 
 #include <tool/tool_base.h>
 
diff --git a/pcb_calculator/transline/transline.cpp b/pcb_calculator/transline/transline.cpp
index 69f6ea4..3d4c823 100644
--- a/pcb_calculator/transline/transline.cpp
+++ b/pcb_calculator/transline/transline.cpp
@@ -21,6 +21,7 @@
  *
  */
 
+#include <cmath>
 #include <limits>
 #include <transline.h>
 #include <units.h>
diff --git a/pcbnew/layer_widget.cpp b/pcbnew/layer_widget.cpp
index 37bffa8..da861fc 100644
--- a/pcbnew/layer_widget.cpp
+++ b/pcbnew/layer_widget.cpp
@@ -40,6 +40,9 @@
 #include <colors.h>
 #include <wx/colour.h>
 
+#include <algorithm>
+
+
 #define BUTT_SIZE_X             20
 #define BUTT_SIZE_Y             18
 #define BUTT_VOID               4
diff --git a/pcbnew/ratsnest_data.h b/pcbnew/ratsnest_data.h
index 72e0530..ec996ba 100644
--- a/pcbnew/ratsnest_data.h
+++ b/pcbnew/ratsnest_data.h
@@ -39,6 +39,8 @@
 #include <boost/unordered_map.hpp>
 #include <boost/foreach.hpp>
 
+#include <deque>
+
 class BOARD;
 class BOARD_ITEM;
 class BOARD_CONNECTED_ITEM;
diff --git a/pcbnew/router/pns_diff_pair.cpp b/pcbnew/router/pns_diff_pair.cpp
index 771928b..9265430 100644
--- a/pcbnew/router/pns_diff_pair.cpp
+++ b/pcbnew/router/pns_diff_pair.cpp
@@ -22,6 +22,7 @@
 
 #include <cstdio>
 #include <cstdlib>
+#include <cmath>
 #include <limits>
 
 #include <geometry/shape.h>
diff --git a/pcbnew/router/pns_optimizer.cpp b/pcbnew/router/pns_optimizer.cpp
index 57b8a0e..2e3d7d5 100644
--- a/pcbnew/router/pns_optimizer.cpp
+++ b/pcbnew/router/pns_optimizer.cpp
@@ -24,6 +24,8 @@
 #include <geometry/shape_rect.h>
 #include <geometry/shape_convex.h>
 
+#include <cmath>
+
 #include "pns_line.h"
 #include "pns_diff_pair.h"
 #include "pns_node.h"
diff --git a/pcbnew/router/pns_utils.cpp b/pcbnew/router/pns_utils.cpp
index 31eb78d..f7871be 100644
--- a/pcbnew/router/pns_utils.cpp
+++ b/pcbnew/router/pns_utils.cpp
@@ -25,6 +25,8 @@
 
 #include <geometry/shape_segment.h>
 
+#include <cmath>
+
 const SHAPE_LINE_CHAIN OctagonalHull( const VECTOR2I& aP0, const VECTOR2I& aSize,
                                       int aClearance, int aChamfer )
 {
diff --git a/pcbnew/tools/conditional_menu.h b/pcbnew/tools/conditional_menu.h
index af9ef2f..70e0e14 100644
--- a/pcbnew/tools/conditional_menu.h
+++ b/pcbnew/tools/conditional_menu.h
@@ -27,6 +27,7 @@
 
 #include "selection_conditions.h"
 #include <boost/unordered_map.hpp>
+#include <list>
 #include <wx/wx.h>
 
 class SELECTION_TOOL;
diff --git a/pcbnew/tools/edit_points.h b/pcbnew/tools/edit_points.h
index c939eca..ca9e373 100644
--- a/pcbnew/tools/edit_points.h
+++ b/pcbnew/tools/edit_points.h
@@ -30,6 +30,9 @@
 #include <base_struct.h>
 #include <layers_id_colors_and_visibility.h>
 
+#include <list>
+#include <deque>
+
 #include "edit_constraints.h"
 
 /**
diff --git a/polygon/math_for_graphics.cpp b/polygon/math_for_graphics.cpp
index 5d1152a..d88e434 100644
--- a/polygon/math_for_graphics.cpp
+++ b/polygon/math_for_graphics.cpp
@@ -7,6 +7,7 @@
 #include <limits.h>
 #include <common.h>
 #include <cstdlib>      // for abs function on ints
+#include <algorithm>
 #include <math_for_graphics.h>
 
 static bool InRange( double x, double xi, double xf );
diff --git a/utils/idftools/idf_common.cpp b/utils/idftools/idf_common.cpp
index 8eedfa6..45542e0 100644
--- a/utils/idftools/idf_common.cpp
+++ b/utils/idftools/idf_common.cpp
@@ -24,6 +24,7 @@
  */
 
 
+#include <algorithm>
 #include <list>
 #include <string>
 #include <iostream>

Follow ups

References