Q: cref reference format for label type `' undefined I have this error that I suspect comes from the fact that my tables and figures are in a slave file. It seems that cleveref does not manage to see the "class" of my float. I tried with varioref and I have a similar issue, I tried to put the \includegraphics before the text, I updated my TeXLive...  Any help is welcome.
Here my example (sorry if it's not following the proper rule but it's my first time with a question).
\documentclass[english]{article}
\usepackage{graphicx}
\usepackage{lscape, rotating} 
\usepackage{tabu, longtable} 
\usepackage{babel}
\usepackage{hyperref, varioref, cleveref}
\usepackage[xindy, acronym, nonumberlist]{glossaries}

\begin{document}

Before running any analysis we first checked for collinearity or correlation 
among variables and did not notice any specific relationship (scatterplot 
not shown).

We present here scatterplot matrix of data grouped by theme: presence data 
(\vref{Pevex8r}), CPUE data (\vref{Cevex8r}) and time and location data 
(\vref{TLevex8r}).

As \gls{CPUE} data are severely skewed, we transformed them using a $log$ 
transformation: $\log($\gls{CPUE}$+1)$ (\vref{CTevex8r}). 

\include{figure_Recap1}
\end{document}

Here is what my slave file looks like: 
\begin{figure}
\scalebox{0.8}{
\includegraphics{../../R/Data_exploration/Plots/Pevex8r.pdf}
}
\label{Pevex8r}\caption{Scatterplot matrix of species presence variable} 
\end{figure}

\begin{figure}
\scalebox{0.7}{
\includegraphics{../../R/Data_exploration/Plots/TLevex8r}
}
\label{TLevex8r}\caption{Scatterplot matrix of time and location variable} 
\end{figure}

etc...

A: In my case the error message was resolved by trying yet another ordering of loading the three packages varioref, cleveref and hyperref:


*

*varioref

*hyperref

*cleveref


Source: https://en.wikibooks.org/w/index.php?title=LaTeX/Labels_and_Cross-referencing section "Interpackage interactions for varioref, hyperref, and cleveref"

A: You have to put the \label command after the \caption. Then, both \vref and \cref will work. 
The reason for the error is that cleveref and varioref cannot determine the type of the label unless \caption is issued first. Putting the label after the caption will tell cleveref and varioref that the object's type is, in both of the examples you give, figure.

A: I encountered this error when I placed my \crefname statement inside my document instead of in my preamble. (The location with the preamble may also matter; see the other answers).
