[Tex/LaTex] minted package: Undefined control sequence

minted

I just installed the minted package to type prettier code in my university reports, I'm trying it out but I keep getting the same messages when compiling:

This is the source:

\documentclass{report}
\usepackage{minted}
\begin{document}
\begin{minted}{c}
  int i,j,k,n;
\end{minted}
\end{document}

I compile it with:

pdflatex --shell-escape source.tex

This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
 \write18 enabled.
entering extended mode
(./source.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, spanish, galician, catalan, loaded.
(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size10.clo)) (./minted.sty
(/usr/share/texmf-texlive/tex/latex/graphics/keyval.sty)
(/usr/share/texmf-texlive/tex/latex/fancyvrb/fancyvrb.sty
Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix 
<2008/02/07> (tvz)) (/usr/share/texmf/tex/latex/xcolor/xcolor.sty
(/etc/texmf/tex/latex/config/color.cfg)
(/usr/share/texmf-texlive/tex/latex/pdftex-def/pdftex.def))
(/usr/share/texmf-texlive/tex/latex/float/float.sty)
(/usr/share/texmf-texlive/tex/latex/base/ifthen.sty)
(/usr/share/texmf-texlive/tex/latex/tools/calc.sty) (./ifplatform.sty))
! Undefined control sequence.
\minted.sty-h@@k ...elax  \ifnum \pdf@shellescape 
                                                  =1\relax \else \PackageErr...
l.3 

? ! Missing number, treated as zero.
<to be read again> 
                   =
l.3 

? 
! Package minted Error: You must invoke LaTeX with the -shell-escape flag.

See the minted package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.3 

? /usr/bin/pygmentize
(./source.aux) (/usr/share/texmf-texlive/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (./source.pyg) (./source.out.pyg) [1{/var/lib/texmf/fonts/map/pdftex/updmap/p
dftex.map}] (./source.aux) )</usr/share/texmf-texlive/fonts/type1/public/amsfon
ts/cm/cmr10.pfb></usr/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmtt10
.pfb>
Output written on source.pdf (1 page, 18733 bytes).
Transcript written on source.log.

The output looks as expected but why does all of these messages appear?

Best Answer

Command \pdf@shellescape is defined in package pdftexcmds (part of bundle oberdiek), if the TeX compiler supports the status query of the write18/shell escape feature.

Therefore just add \usepackage{pdftexcmds} before \usepackage{minted}.