showexpl not showing caption of a lstlisting within

How can I make the LTXexample environment to show the caption (like it does with other environments) of a lstlisting that is inside it.

Consider the following code

\documentclass{article}

\usepackage{showexpl}

\begin{document}
\pagestyle{empty}

% This lstlisting has its own caption
\begin{lstlisting}[language=C++,caption={Caption of lstlisting}]
#include<iostream>

int main{
std::cout << "Hello LaTeX\n";
}
\end{lstlisting}

% The lstlisting caption is not shown here
\begin{LTXexample}[pos=b,rframe={},caption={Caption of LTXexample}]
\begin{lstlisting}[language=C++,caption={Caption of lstlisting}]
#include<iostream>

int main{
std::cout << "Hello LaTeX\n";
}
\end{lstlisting}
\end{LTXexample}

\end{document}


As you can see in the image below, when showing the example, the caption of the lstlisting within the LTXexample doesn't has a caption. I think it may be because the implementation of that environment depends on an lstlisting. So, how can I make it to display such caption properly?

Moreover, note that the label within the lstlisting environment is also ignored.

\def\xstrut{\protect\rule[-2ex]{0pt}{2ex}}

% The lstlisting caption is not shown here
\begin{LTXexample}[pos=b,rframe={},caption={Caption of LTXexample\xstrut}]
\begin{lstlisting}[language=C++,caption={Caption of lstlisting}]
#include<iostream>

int main{
std::cout << "Hello LaTeX\n";
}
\end{lstlisting}
\end{LTXexample}


• But if you see carefully, the second frame doesn't have a caption. It needs a caption that says "Listing 3: Caption of lstlisting". – adn Jul 23 '14 at 21:32
• Ah I see. Missed that point. – user2478 Jul 23 '14 at 21:43