There are many old buildings that are still in use today:
https://www.grunge.com/327172/the-oldest-buildings-still-in-use-today/
While software longevity is not subject to weather and natural disasters, there are forces that impact software longevity:
http://laputan.org/mud/
If you needed to build software that does its job and stands the test of time, what choices would you make?
What programming language(s) would you use?
Why?
I don't think that the language its in matters a great deal as long as its one that has very wide and deep support. In today's languages, that would mean C/C++, Java, COBOL, and a few others that escape me at the moment.
The bigger issue is going to be hardware changes. A lot of the half-century software I've touched was written for mainframes from the '60s and '70s -- and it's still running today only because those mainframes are being emulated on modern hardware.
I think that, generally, the way you build software that will last is just to engage in excellent engineering practices. Document everything well, keep the code simple, don't get cute or clever, don't follow the fashion of the day, use good names for procedures and variables, don't use magic numbers, and so forth.