Let $G$ be a connected and simply connected Lie group with its Lie algebra $\mathfrak{g}$. Assume that $[c]\in H^2 (\mathfrak{g};\mathbb{R})$ is a non-trivial 2-cocycle. Then we can construct a non-trivial central extension $\hat{\mathfrak{g}}_c\equiv\mathfrak{g}\oplus\mathbb{R}$ of $\mathfrak{g}$ with the Lie bracket $$[(X,\lambda),(Y,\mu)]=([X,Y],c(X,Y)).$$ Consider the linear map $H^2 (G;\mathbb{R})\to H^2 (\mathfrak{g};\mathbb{R})$ defined by $[C]\mapsto [\delta C]$ where $$\delta C(X,Y)=\frac{\partial^2}{\partial t\partial s}\Big[ C(e^{tX},e^{sY})-C(e^{sY},s^{tX})\Big]\Big|_{t=0,s=0}.$$
If we can find a 2-cocycle $[C]\in H^2 (\mathfrak{g};\mathbb{R})$ such that $\delta C=c$, then since $c$ is non-trivial, so is $C$. Accordingly, the group $\hat{G}_C\equiv G\times \mathbb{R}$ with group operation $(f,\lambda)\cdot (g,\mu)=(fg,\lambda +\mu +C(f,g))$ is a non-trivial central extension of $G$.
But if we can't find such a 2-cycloce $C$ such that $\delta C=c$, how can we find a non-trivial central extension of $G$?
I guess that if we can find a Lie group corresponding to the Lie algebra $\hat{\mathfrak{g}}_c$, it can be a non-trivial central extension of $G$. Is that true? and how can we do that?