In a recent paper by Zhao and the author, the Lie algebras $A[D]=A\otimes
F[D]$ of Weyl type were defined and studied, where $A$ is a commutative
associative algebra with an identity element over a field $F$ of any
characteristic, and $F[D]$ is the polynomial algebra of a commutative
derivation subalgebra $D$ of $A$. In the present paper, the 2-cocycles of a
class of the above Lie algebras $A[D]$ (which are called the Lie algebras of
generalized differential operators in the present paper), with $F$ being a
field of characteristic 0, are determined. Among all the 2-cocycles, there is a
special one which seems interesting. Using this 2-cocycle, the central
extension of the Lie algebra is defined.