\documentclass{article}
\begin{document}
\tableofcontents

Hello!
\ref{first section}
\ref{second section}
\input{sub}
\include{sub2}
\include{path/to/file}

\end{document}
