I used this method for my gingerbread house. I caramelised the sugar and used as glue.
I used it for window glasses too!
For windows: take your wall with the hole for the window and place it on a silicon foil (nice side up). Spoon in the hole some hot melted sugar, spread well and wait until cold.
Very easy, fast and efficient.