\documentclass{article}

\usepackage{minted}

\begin{document}
\section{First}
\begin{listing}
  \mint{cl}/car (cons 1 '(2))/
  \caption{Some listing}
  \label{lst:test}
\end{listing}

\section{Second}
See listing \ref{lst:test}.

\section{Third}
\listoflistings
\end{document}
