 Educated at Glasgow University, and afterwards at the Royal Military Academy, Woolwich.In 1758, he was commissioned into the Royal Engineers.He served with them in the Seven Years' War and was wounded at the Siege of Quebec.