diff --git a/eeschema/sim/ngspice.h b/eeschema/sim/ngspice.h index 4542e11552..68063331be 100644 --- a/eeschema/sim/ngspice.h +++ b/eeschema/sim/ngspice.h @@ -27,12 +27,14 @@ #ifndef NGSPICE_H #define NGSPICE_H -#include +#include + +// Include simulator headers after wxWidgets headers to avoid conflicts with Windows headers +// (especially on msys2) +#include "sim/spice_simulator.h" #include #include -#include - #include #include diff --git a/eeschema/sim/sim_lib_mgr.cpp b/eeschema/sim/sim_lib_mgr.cpp index 9db39f2dee..e92dbabeb6 100644 --- a/eeschema/sim/sim_lib_mgr.cpp +++ b/eeschema/sim/sim_lib_mgr.cpp @@ -22,13 +22,16 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include #include -#include -#include #include #include +// Include simulator headers after wxWidgets headers to avoid conflicts with Windows headers +// (especially on msys2) +#include +#include +#include + SIM_LIB_MGR::SIM_LIB_MGR( const PROJECT& aPrj ) : m_project( aPrj ) { diff --git a/eeschema/sim/sim_model.cpp b/eeschema/sim/sim_model.cpp index f2b2f047f0..8a02b89454 100644 --- a/eeschema/sim/sim_model.cpp +++ b/eeschema/sim/sim_model.cpp @@ -22,6 +22,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#include +#include + #include #include #include @@ -38,9 +41,6 @@ #include -#include -#include - #include #include #include @@ -833,7 +833,7 @@ std::unique_ptr SIM_MODEL::Create( TYPE aType ) case TYPE::C: case TYPE::L: return std::make_unique( aType ); - + case TYPE::R_POT: return std::make_unique(); @@ -924,7 +924,7 @@ SIM_MODEL::SIM_MODEL( TYPE aType, SIM_MODEL::SIM_MODEL( TYPE aType, std::unique_ptr aSpiceGenerator, - std::unique_ptr aSerde ) : + std::unique_ptr aSerde ) : m_baseModel( nullptr ), m_serde( std::move( aSerde ) ), m_spiceGenerator( std::move( aSpiceGenerator ) ), diff --git a/eeschema/sim/sim_model_kibis.cpp b/eeschema/sim/sim_model_kibis.cpp index 41738ccf68..5221831a00 100644 --- a/eeschema/sim/sim_model_kibis.cpp +++ b/eeschema/sim/sim_model_kibis.cpp @@ -21,14 +21,15 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include -#include #include #include #include #include +#include +#include +#include + std::string SPICE_GENERATOR_KIBIS::ModelName( const SPICE_ITEM& aItem ) const { return fmt::format( "{}.{}", aItem.refName, aItem.baseModelName ); diff --git a/eeschema/sim/sim_model_spice.cpp b/eeschema/sim/sim_model_spice.cpp index c302bc6ea0..314ecf28a6 100644 --- a/eeschema/sim/sim_model_spice.cpp +++ b/eeschema/sim/sim_model_spice.cpp @@ -21,12 +21,14 @@ * or you may write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#include +// Include simulator headers after wxWidgets headers to avoid conflicts with Windows headers +// (especially on msys2) #include #include #include #include -#include #include diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp index 22668a2d24..00a79eda7f 100644 --- a/eeschema/sim/sim_plot_frame.cpp +++ b/eeschema/sim/sim_plot_frame.cpp @@ -26,6 +26,9 @@ #include #include +// For some obscure reason, needed on msys2 with some wxWidgets versions (3.0) to avoid +// undefined symbol at link stage (due to use of #include ) +#include #include #include @@ -40,12 +43,6 @@ #include "string_utils.h" #include "ngspice_helpers.h" #include -#include "ngspice.h" -#include "sim_plot_colors.h" -#include "sim_plot_frame.h" -#include "sim_plot_panel.h" -#include "spice_simulator.h" -#include "spice_reporter.h" #include #include #include @@ -55,6 +52,14 @@ #include #include +// Include simulator headers after wxWidgets headers to avoid conflicts with Windows headers +// (especially on msys2) +#include "ngspice.h" +#include "sim_plot_colors.h" +#include "sim_plot_frame.h" +#include "sim_plot_panel.h" +#include "spice_simulator.h" +#include "spice_reporter.h" SIM_PLOT_TYPE operator|( SIM_PLOT_TYPE aFirst, SIM_PLOT_TYPE aSecond ) { diff --git a/eeschema/sim/sim_property.cpp b/eeschema/sim/sim_property.cpp index 7e5580695e..ad544c3299 100644 --- a/eeschema/sim/sim_property.cpp +++ b/eeschema/sim/sim_property.cpp @@ -21,15 +21,17 @@ * or you may write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - -#include -#include #include #include #include #include #include +// Include simulator headers after wxWidgets headers to avoid conflicts with Windows headers +// (especially on msys2) +#include +#include + wxBEGIN_EVENT_TABLE( SIM_VALIDATOR, wxValidator ) EVT_KEY_DOWN( SIM_VALIDATOR::onKeyDown ) diff --git a/eeschema/sim/sim_property.h b/eeschema/sim/sim_property.h index e9450d5a49..79dfe19bec 100644 --- a/eeschema/sim/sim_property.h +++ b/eeschema/sim/sim_property.h @@ -25,13 +25,15 @@ #ifndef SIM_PROPERTY_H #define SIM_PROPERTY_H -#include #include #include #include #include #include +// Include this header after wxWidgets headers to avoid conflicts with Windows headers +// (especially on msys2) +#include class SIM_VALIDATOR : public wxValidator { diff --git a/eeschema/sim/sim_value.h b/eeschema/sim/sim_value.h index 2b9e066c47..36dbc6de33 100644 --- a/eeschema/sim/sim_value.h +++ b/eeschema/sim/sim_value.h @@ -29,8 +29,10 @@ #include #include #include -#include +// Include this header after wxWidgets headers to avoid conflicts with Windows headers +// (especially on msys2) +#include namespace SIM_VALUE_GRAMMAR { @@ -161,7 +163,7 @@ namespace SIM_VALUE_GRAMMAR template struct significand; - + template <> struct significand : sor, fracPart>, seq>, diff --git a/eeschema/sim/spice_simulator.cpp b/eeschema/sim/spice_simulator.cpp index 1627ec9e33..a8ee285fb7 100644 --- a/eeschema/sim/spice_simulator.cpp +++ b/eeschema/sim/spice_simulator.cpp @@ -23,10 +23,12 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "ngspice.h" - #include +// Include simulator headers after wxWidgets headers to avoid conflicts with Windows headers +// (especially on msys2) +#include "ngspice.h" + std::shared_ptr SIMULATOR::CreateInstance( const std::string& ) { try diff --git a/eeschema/sim/spice_value.cpp b/eeschema/sim/spice_value.cpp index 26649f5d12..934823ff8f 100644 --- a/eeschema/sim/spice_value.cpp +++ b/eeschema/sim/spice_value.cpp @@ -22,11 +22,10 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "spice_value.h" - #include #include +#include #include #include #include @@ -34,6 +33,11 @@ #include #include +// Include simulator headers after wxWidgets headers to avoid conflicts with Windows headers +// (especially on msys2) +#include "spice_value.h" + + SPICE_VALUE::SPICE_VALUE( const wxString& aString ) { char buf[8] = { 0, };