The World Health Organisation describes mental health as
"a state of well-being in which the individual realises his or her own abilities, can cope with the normal stresses of life...and is able to make a contribution to his or her community."
Few homeless people would pass this test.
A mental illness is a psychological or behavioural pattern that someone experiences which causes them distress or disability.