I read Hyperlink with answers and have tried to apply the technique to my environments that I have defined using the ntheorem package.

In the MWE below the answer links correctly go to the questions, but the questions do not go to the answers. How can this be fixed?

\documentclass{report}
\usepackage{ntheorem}
\usepackage{changepage}
\usepackage{lipsum}
\usepackage{hyperref}

\makeatletter
\newtheoremstyle{hanging}%
\makeatother

% problem environment
\newlength{\problabel}
\theoremstyle{hanging}
\theoremprework{%
\hypertarget{prob:\theproblem}{}%
\settowidth{\problabel}{\textbf{\theproblem} }%
\newtheorem{problem}{}

% solution environment
\Newassociation{sol}{Soln}{solutionfilehandle}
\renewenvironment{Soln}[1]
{}

\begin{document}

\Opensolutionfile{solutionfilehandle}[ans1]

\section{Problems}
\begin{problem}
\lipsum[1]
\begin{sol}
First solution.
\end{sol}
\end{problem}

\begin{problem}
\lipsum[2]
\begin{sol}
second solution.
\end{sol}
\end{problem}

\Closesolutionfile{solutionfilehandle}
\newpage
\section{Solutions}
\input{ans1}
\end{document}


EDIT: It also helped to have the target first:

    % solution environment
\Newassociation{sol}{Soln}{solutionfilehandle}
\renewenvironment{Soln}[1]

I compiled your MWE (TeXlive 2011), and it worked just fine: questions link to answers, and answers link to questions. Did you make a rerun? Could you add a \listfiles before \begin{document} and post the result (especially: which hyperref version did you use)?
• Thanks very much, that did it. I also changed my compile method from pdflatex to LaTeX, and changed the position of the anchor (see edit above) – cmhughes Aug 27 '11 at 22:23