[Tex/LaTex] Images in a presentation

beamergraphicspresentations

This is my first time being here. The site is such an asset. Asking this only because I couldn't get it done.
Question. I want to insert two (may be three) images with captions for each. I was referring this:
This is my code for that particular frame:

\usepackage{graphicx}
\usepackage{float}

    \begin{frame}
    \begin{tabular}{ccc}
    \subfloat{\includegraphics[width = 2in]{image1.jpg}} &
    \subfloat{\includegraphics[width = 2in]{image2.jpg}} 
    \end{tabular}
    \end{frame}

I get an error saying: \subfloat outside float. I'm using the online .tex editor Overleaf.

Any help is much appreciated.

Best Answer

In a presentation often have little sense numbered subcaptions and the superfluous "Figure:" statement. As the issue with all of this is solved in another answer, my suggestion is not use at all figure floats, captions or any related package:

mwe

\documentclass{beamer}
\begin{document}
\begin{frame}\centering
\begin{columns}
\begin{column}{.3\linewidth}\centering
\includegraphics[width=\linewidth]{example-image-a}\par 
The image A
\end{column}
\begin{column}{.3\linewidth}\centering
\includegraphics[width=\linewidth]{example-image-b}\par 
The image B
\end{column}
\begin{column}{.3\linewidth}\centering
\includegraphics[width=\linewidth]{example-image-c}\par 
The image C
\end{column}
\end{columns}
\bigskip
The main caption
\end{frame}
\end{document}