Q:

Reference to my subfloats always reference to Fig 1a, 1b or 1c

I have a document where multiple figures with subfloats are included, like this one:
\documentclass[pdftex, a4paper, oneside]{scrartcl}
\usepackage[lofdepth,lotdepth]{subfig}
\usepackage{graphicx}
\begin{document}
test
\ref{fig:2ref1}
\ref{fig:1ref1}
\section{test}
\begin{figure}[h]
\subfloat[][caption1]{
\includegraphics[width=0.45\textwidth]{pictures/1.pdf}
\label{fig:1ref1}
}
\subfloat[][caption]{
\includegraphics{pictures/2.pdf}
\label{fig:1ref2}
}
\end{figure}
\section{test2}
\begin{figure}[h]
\subfloat[][caption]{
\includegraphics[]{pictures/1.pdf}
\label{fig:2ref1}
}
\subfloat[][captio]{
\includegraphics{pictures/2.pdf}
\label{fig:2ref2}
}
\end{figure}
\end{document}

The problem now is that both     \ref{fig:2ref1} and    \ref{fig:1ref1} return 1a as picture reference, even if they are different pictures and should be 1a and 2a.

A:

As I mention in comment, the problem is that the figure counter is not incremented, because you do not have a \caption in the figure environments. If you add a caption inside each figure, outside the subfloats, you get the desired outcome.

\documentclass[a4paper, oneside]{scrartcl}
\usepackage[lofdepth,lotdepth]{subfig}
\begin{document}

\ref{fig:1ref1}
\ref{fig:1ref2}

\ref{fig:2ref1}
\ref{fig:2ref2}

\begin{figure}[h]
\centering
\subfloat[][caption1]{
FIGURE 1A
\label{fig:1ref1}
}
\subfloat[][caption]{
FIGURE 1B
\label{fig:1ref2}
}
\caption{First figure}
\end{figure}

\begin{figure}[h]
\centering
\subfloat[][caption]{
FIGURE 2A
\label{fig:2ref1}
}
\subfloat[][captio]{
FIGURE 2B
\label{fig:2ref2}
}
\caption{Second figure}
\end{figure}
\end{document}

