Building, edifice, structure, pile are comparable when they mean a construction (as of wood, brick, or stone) intended to house a family, a business, or an institution.
Building is the common and in most cases the adequate term.
Edifice usually applies to large and elegant buildings.
Structure retains more frequently than the others the sense of something constructed, often in a particular way.
Like edifice, structure is often used of buildings of some size or magnificence.
Pile is a somewhat literary term for a very large building or sometimes a cluster of buildings especially of stone; it usually suggests a public or official structure (as a palace, a cathedral, or a government building.