Solar gamma-ray lines, produced from nuclear reactions of accelerated particles interacting with solar atmosphere ambient medium, are the most direct diagnosis about the acceleration and transport of electrons and ions in solar flares. Analysis of gamma-ray line spectrum in solar flare has provided information about composition, spectrum and angular distribution of the accelerated ions, as well as elemental abundance of the ambient solar atmosphere. A new gamma-ray calculation program was developed by using an efficient nuclear code TALYS. The theory of gamma-ray production in solar flares is treated in detail. In addition, the characteristics of gamma-ray spectrum are also presented.