Some will frown on this, but the error is $\lambda$
being used in \begin{equation}...\end{equation}
when \gls{slambda}
is replaced with $\lambda$
then.
It's not possible to use $...$
inside equation
-like environments.
Omitting works for the environment, but then \printglossaries
complains about missing math mode.
One possible solution is to apply \ensuremath
around \lambda
. It will use math mode if it's not already in math mode then -- so it is safe to use it.
\documentclass{article}
\usepackage{glossaries}
\makeglossaries
\newglossaryentry{slambda}{%
name=\ensuremath{\lambda},
description={wavelength}
}
\begin{document}
\begin{equation}
\gls{slambda} = \frac{c}{f}
\end{equation}
\printglossary % for usage with makeglossaries program
\end{document}
