Consider this MWE:
\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage[dvips]{hyperref}
\usepackage[noabbrev,nameinlink]{cleveref}
\begin{document}
\section{Abc}
\begin{figure}
\label{fig:a}
\centering
\rule{20mm}{20mm}
\caption{abc}
\end{figure}
In \cref{fig:a} $\ldots$
\end{document}
From this example you expect an expansion of the sentence
In \cref{fig:a} $\ldots$
into
In Figure 1 ...
however on my system this compiles to either ?? (for unknown reference) or gets a chapter, section or subsection 1 reference depending on other labels used in the text. However other types of cref references like references to a table, section, listing, etc work as expected even when used with other classes and compilers. Is this a bug in cleveref, are there solutions, or is their an error in my setup?
labelafter thecaption- this fixes the issue, and your question seems like a duplicate of Why does an environment's label have to appear after the caption? Let us know, and we'll close it :) As your code stands, thelabelis applied to the most recent 'thing' that has a counter, which in your code is asection, hence the confusion – cmhughes Oct 28 '13 at 02:29