The Scottish Labour chief made the pledge as charity Crisis Scotland urged all parties to commit to eradicating homelessness by 2040.