diff --git a/eeschema/sim/ngspice.cpp b/eeschema/sim/ngspice.cpp index 62195916b6..7e98cbc84a 100644 --- a/eeschema/sim/ngspice.cpp +++ b/eeschema/sim/ngspice.cpp @@ -559,6 +559,19 @@ void NGSPICE::init_dll() Command( "set noaskquit" ); Command( "set nomoremode" ); + // reset and remcirc give an error if no circuit is loaded, so load an empty circuit at the + // start. + + vector lines; + lines.push_back( strdup( "*" ) ); + lines.push_back( strdup( ".end" ) ); + lines.push_back( nullptr ); // Sentinel. + + m_ngSpice_Circ( lines.data() ); + + for( auto line : lines ) + free( line ); + m_initialized = true; }