# Package installed but not working

I installed the MacTEX package, and want to use the listings package for pretty printing code. According to the TeX Live Utility, the package is installed (I tried re-installing it as well). However, when I try typesetting via TeXShop, I get an error:

l.4 \usepackage
{listings}
?


Does anyone know what the problem is?

EDIT: Complete document code:

\documentclass[twoside,a4paper,12pt,titlepage]{article}
\begin{document}
\author{--}
\usepackage{listings}
\title{--}
\maketitle
\section{1}
Lorem ipsum.
\end{document}

• Can you show your code? – Juri Robl Sep 7 '14 at 10:23
• @JuriRobl Sure! Edited now. – Vegard Stikbakke Sep 7 '14 at 10:25
• Welcome to TeX.SX! The error message is before the l.4 line and starts with !; can you show it? – egreg Sep 7 '14 at 10:25
• You can't use \usepackage after \begin{document}, move it befor it. – Juri Robl Sep 7 '14 at 10:25
• @JuriRobl Oh, wow! That was it, thanks a lot! – Vegard Stikbakke Sep 7 '14 at 10:27

which basically means you can't use it in your document part (after \begin{document}), but before it. That's your preamble, and is the only place where you can use some commands like \usepackage.