Integration by parts to prove a function is constant a.e. Let $(a,b)$ be an interval on $\mathbb{R}$. Let $f \in L^1(a,b)$. Assume that $$
\int_a^b f(x)g'(x)\, dx =0
$$
for all $C^1$ functions $g$ with support compactly contained in $(a,b)$. Prove that there is a constant $c$ such that $f(x)=c$ for almost every $x \in (a,b)$. 
My thought was to use integration by parts so as to have $$
\int_a^b g(x)df(x)=0
$$
but since $f(x)$ is only integrable, it does not seem to work. 
Any help/hint is appreciated! 

Hint: If you happen to know that 
$$ \int_a^b f(x) h(x) dx = 0 , \ \ \forall h\in C_c((a,b)): \int_a^b h\; dx=1$$
implies that $f$ vanish
then you may reduce to this situation by considering the difference 
of two such $h$'s. One of them will give rise to the constant $c$.
