# Conflict of hyperref with \addtocounter

For some reasons, I need to define the captions before the tables with the help of the capt-of package. When I am trying to use the hyperref package, a conflict occurs with \addtocounter and the following warning is issued (but no obvious problem can be observed in the generated PDF file):

pdfTex warning (ext4): destination with the same identifier (name{table.2}) has been already used, duplicate ignored.


My sample code is the following:

\documentclass[a4paper,pra,aps,11pt]{revtex4-2}

\usepackage{float}
\usepackage{hyperref}
\usepackage{amsmath,amssymb}
\usepackage[english]{babel}
\usepackage{longtable}
\usepackage{capt-of}

\begin{document}

\captionof{table}{test A}
\begin{longtable}{l}
\end{longtable}
\makeatletter\def\@currentlabel{\thetable}\label{table:testA}

\captionof{table}{test B}
\begin{longtable}{l}
\end{longtable}
\makeatletter\def\@currentlabel{\thetable}\label{table:testB}

table~\ref{table:testA} and table~\ref{table:testB}

\end{document}


Could you please help me how to avoid this warning? Please don't suggest that I remove the capt-of package(..).

\documentclass[a4paper,pra,aps,11pt]{revtex4-2}

\usepackage{float}
\usepackage{hyperref}
\usepackage{amsmath,amssymb}
\usepackage[english]{babel}
\usepackage{longtable}
\usepackage{capt-of}
\newcounter{abstable}
\renewcommand\theHtable{\arabic{abstable}.\thetable}
\begin{document}

\captionof{table}{test A}
\begin{longtable}{l}
\end{longtable}