You need to provide a default constructor for port
to initialize it's members automatically
struct port
{
port() :
isOutput(false),
isConnected(false),
connwires(0)
{ }
bool isOutput;
bool isConnected;
int connwires;
};
Note that your last code is valid and does what you expect since C++11.