How to show that function $\phi\in\mathcal D'(\mathbb R)$ can be represented as derivative of function $\phi_1\in\mathcal D(\mathbb R)$ if and only if: $\int_{-\infty}^{\infty}\phi(x)dx=0$.
One direction is easy: if $\phi=\phi'_1$, then $\int_{-\infty}^{\infty}\phi'_1(x) dx=\phi_1(\infty)-\phi_1(-\infty)=0$, but I don't know how to show the other implication. Any help is welcome.
The natural choice is to take $\phi_1(x):=\int_{-\infty}^x\phi(t)dt$. Since $\phi$ has a compact support, this is well defined. It's a smooth function, because it's derivable and its derivative is smooth.
What remains to check is that $\phi_1$ has a compact support. Assume that the support of $\phi$ is contained in $[-R,R]$. If $x<R-1$, then $\phi_1(x)=0$. If $x>R+1$, then $$\phi_1(x)=\int_{-\infty}^{R+1}\phi(x)dx=\int_{-\infty}^{+\infty}\phi(x)dx=0,$$ so the support of $\phi_1$ is compact.