The temple, which literally means "rooster crowing" was first constructed in 557 during the Liang Dynasty and has been destroyed and reconstructed many times. The existing temple was initially constructed during the Ming Dynasty during the reign of Emperor Hongwu in 1387. It was destroyed during the Taiping rebellion but rebuilt.
By 1931 most temple buildings had been appropriated as barracks by police and army of the KMT regime. The main hall had been emptied completely apart from the large Buddha statue. Only one hall, near the city wall was still being used for worship. The temple remained popular primarily because of its tea house which was also situated in that hall.
Within the temple are Guanyin Hall (观音殿), Huomeng Building (豁蒙楼), and the Medicine Buddha Pagoda (Chinese: 药师佛塔). The Rouge Well (胭脂井), got its name from a legend that the emperor of the Southern Tang Dynasty and his concubine hid themselves in the well to escape enemy pursuit. The stains of rouge were left on the well: hence the name of Rouge Well.
The seven-story pagoda overlooks Xuanwu Lake. There is an entrance to the Nanjing City Wall from the rear of the temple. Behind the temple there remains a section of palace wall called Taicheng.