Trigonometric system is complete proof-Lebesgue Integration by parts Page 8, Chapter 1 in R. Young's "Introduction to non-harmonic analysis". I cannot follow the step: "Integration by parts shows that..." 
Theorem 2.
The trigonometric system is complete in $L^2[-\pi,\pi]$.
Proof:
Suppose that
$
\begin{align*}
\int_{-\pi}^{\pi}f(t)e^{-int}dt=0
\end{align*}
$
for some integrable function $f(t)$ defined on $[-\pi,\pi]$ and $n=0,\pm1,\pm2,\dots$
We need to show $f=0$ a.e. Set
$
\begin{align*}
g(t)=\int_{-\pi}^{t}f(u)du
\end{align*}
$
for $t\in[-\pi,\pi]$. Integration by parts shows that:(*)
$
\begin{align*}
\int_{-\pi}^{\pi}\big(g(t)-c\big)e^{-int}dt=0
\end{align*}
$
for every constant $c$ and $n=\pm1,\pm2,\pm3$. Choose $c$ so this holds and for $n=0$ also, and put $F(t)=g(t)-c$. Then $F$ is continuous on $[-\pi,\pi]$ and $F(\pi)=F(-\pi)$. Then by Weierstrass's approximation theorem.. (rest of proof is straight forward)
(*)This is where I am stuck. My attempt:
$
\begin{align*}
g(t)=\int_{-\pi}^{t}f(u)du \implies g'(t)=f(t) \quad a.e,
\end{align*}
$
There are details here, but I think that this is just the generalisation of the Fund. theoerm of calculus to Lebesgue integral. I am not sure about applying this to Lebesgue integrable/differentiable functions. Also, I think continuity of $g(t)$ is required at $t$ to write $ g'(t)=f(t) \quad a.e$, and so doesn't this exclude lots of functions in $L^2$?
Anyway, assuming I can do the above I get:
$
\begin{align*}
\int_{-\pi}^{\pi}f(t)e^{-int}dt=0 &\implies
\int_{-\pi}^{\pi}g'(t)e^{-int}dt=0 \\
&\implies \int_{-\pi}^{\pi}g'(t)e^{-int}dt=g(t)e^{-int}\Big|_{-\pi}^{\pi}+in\int_{-\pi}^{\pi}g(t)e^{-int}dt=0 \\
&\implies g(\pi)e^{-in\pi}-g(-\pi)e^{in\pi}
+in\int_{-\pi}^{\pi}g(t)e^{-int}dt=0 \\
&\implies \frac{g(\pi)e^{-in\pi}}{in}
+\int_{-\pi}^{\pi}g(t)e^{-int}dt=0
\end{align*}
$
Also,
$
\begin{align*}
\int_{-\pi}^{\pi}c \: e^{-int}dt=c \: e^{-int}\Big|_{-\pi}^{\pi}
=c\big((-1)^n-(-1)^n\big)=0
\end{align*}
$
So I guess that I choose 
$
\begin{align*}
\frac{g(\pi)e^{-in\pi}}{in}
=\frac{\int_{-\pi}^{\pi}f(u)du\:e^{-in\pi}}{in}=-c \: e^{-int}
\end{align*}
$ 
Then I get
$
\begin{align*}
-c \: e^{-int}+\int_{-\pi}^{\pi}g(t)e^{-int}dt=0 
\end{align*}
$
But I really need:
$
\begin{align*}
\int_{-\pi}^{\pi}(-c \: e^{-int})dt+\int_{-\pi}^{\pi}g(t)e^{-int}dt=0 
\end{align*}
$
Any help appreciated.
 A: 
Also, I think continuity of $g(t)$ is required at $t$

$g$ is the integral of an integrable function, and as such it is continuous everywhere. One can show that with the dominated convergence theorem for example.
In your integration by parts, you overlooked that
$$g(\pi) = g(\pi) - g(-\pi) = \int_{-\pi}^{\pi} f(t)\,dt = \int_{-\pi}^{\pi} f(t) e^{- i\cdot 0\cdot t}\,dt = 0$$
by the assumption on $f$ (using the case $n = 0$), thus you get
$$\int_{-\pi}^{\pi} f(t) e^{-int}\,dt = \int_{-\pi}^{\pi} g'(t) e^{-int}\,dt = g(t)e^{-int}\biggr\rvert_{-\pi}^{\pi} + in \int_{-\pi}^{\pi} g(t)e^{-int}\,dt = in\int_{-\pi}^{\pi} g(t)e^{-int}\,dt.$$
For $n \in \mathbb{Z}\setminus \{0\}$, the assumption on $f$ therefore implies
$$\int_{-\pi}^{\pi} g(t)e^{-int}\,dt = 0.$$
Since also
$$\int_{-\pi}^{\pi} c\cdot e^{-int}\,dt = c\frac{ie^{-int}}{n}\biggr\rvert_{-\pi}^{\pi} = \frac{ci}{n}\bigl(e^{-in\pi} - e^{in\pi}\bigr) = 0$$
for $n\in \mathbb{Z}\setminus \{0\}$ and arbitrary constant $c$, the assertion $(\ast)$ follows. Choosing
$$c = \frac{1}{2\pi}\int_{-\pi}^{\pi} g(t)\,dt$$
then yields
$$\int_{-\pi}^{\pi} \bigl(g(t)- c\bigr)e^{-int}\,dt = 0$$
for all $n\in \mathbb{Z}$.
