Property of cyclic codes
The word $(1,\ldots,1)$ is in your code iff there exists a polynomial $p(x)$ such that $$ \frac{x^n-1}{x-1} = p(x) g(x). $$
Since the code is cyclic, $g(x)$ divides $x^n-1$, and so $(1,\ldots,1)$ is in your code iff there exists a polynomial $p(x)$ such that
$$ \frac{x^n-1}{g(x)} = p(x)(x-1). $$
In other words, $(1,\ldots,1)$ is in your code iff
$$
x-1 \mid \frac{x^n-1}{g(x)}.
$$
I'll let you complete the proof, using the fact that $x-1$ divides $x^n-1$ but not $\frac{x^n-1}{x-1}$.