# Figure referencing throwing reference undefined on input line latex [closed]

I'm trying to make a document and reference some figures that I have, however, some of them are displaying Figure ?? when it's run. The way that I have declared the figures are

\begin{figure}[!h]
\centering
\includegraphics[scale=0.5]{abc.png}
\caption{abc}
\label{fig:abc}
\end{figure}


and I've declared the figure by using \ref{abc} and I don't know why I'm getting the error.

## closed as unclear what you're asking by Andrew Swann, Stefan Pinnow, egreg, user13907, user31729 Sep 10 '16 at 21:26

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Did you run latex twice? – Au101 Apr 26 '16 at 23:20
• @Au101 How do I do that? I mainly only use the Recompile button – smitthy Apr 26 '16 at 23:23
• Hi, welcome to the site! It would help if you could be a little bit more specific than 'the Recompile button', there are many editors - some designed specifically for LaTeX, some general purpose - and none of them are inherent to TeX/LaTeX, you can write it using Notepad, you can write it using emacs, vim, TeXworks, TeXShop, you can even write it straight on the Terminal. However, the point is, you have to compile twice. What editor are you using and what happens if you press that button and then press it again? – Au101 Apr 26 '16 at 23:28
• And you need to compile twice without deleting generated files in between (e.g. the .aux file). – cfr Apr 26 '16 at 23:29
• You have \label{fig:abc} and \ref{abc}; the label and the reference should have the same string: \ref{fig:abc} will work. – egreg Apr 26 '16 at 23:35