[Tex/LaTex] Keep getting “aux file” error with the lastpage package


Keep getting "aux file" error with the lastpage package. The same code is working in another file but not in this one (code furnished here). Please help! Thank you!

\documentclass[margin, 11pt]{res}
\usepackage{helvet}                  % Default font is the helvetica postscript font

\usepackage{fancyhdr}                % http://ctan.org/pkg/fancyhdr
  \pagestyle{fancy}                  % Set default page style to fancy
  \renewcommand{\headrulewidth}{0pt} % Remove header rule
  \fancyhead{}                       % Remove all header contents
  \cfoot{Parul Gupta\\ Page \thepage\ of \pageref{LastPage}}
                                     % Page X of Y in the footer (centered)

%\cfoot{\thepage\ of \pageref{LastPage}}
\moveleft.5\hoffset\centerline{\large\bf Parul Gupta} % Your name at the top

\moveleft\hoffset\vbox{\hrule width\resumewidth height 0.25pt}\smallskip % Horizontal line after name; adjust line thickness by changing the '1pt'

\moveleft.5\hoffset\centerline{add line 1 } % Your address
\moveleft.5\hoffset\centerline{add line 2}


Best Answer

As part of the res.cls document class, it executes:

\nofiles         % resume's don't need .aux files

This avoid the creation of auxiliary files, needed when using references (which lastpage requires). So, add


before loading the document class.