In the recent proposal [S. W. Wei et al., Black Hole Solutions as Topological Thermodynamic Defects, Phys. Rev. Lett. 129, 191101 (2022).], the black holes were viewed as topological thermodynamic defects by using the generalized off shell free energy. In this paper, we follow such proposal to study the local and global topological natures of the Gauss-Bonnet black holes in anti--de Sitter (AdS) space. The local topological natures are reflected by the winding numbers, where the positive and negative winding numbers correspond to the stable and unstable black hole branches. The global topological natures are reflected by the topological numbers, which are defined as the sum of the winding numbers for all black hole branches and can be used to classify the black holes into different classes. When the charge is present, we find that the topological number is independent on the values of the parameters, and the charged Gauss-Bonnet AdS black holes can be divided into the same class of the Reissner-Nordstr\"om anti-de Sitter black hole black holes with the same topological number 1. However, when the charge is absent, we find that the topological number has certain dimensional dependence. This is different from the previous studies, where the topological number is found to be a universal number independent of the black hole parameters. Furthermore, the asymptotic behaviors of curve $\ensuremath{\tau}({r}_{h})$ in small and large radii limit can be a simple criterion to distinguish the different topological number. We find a new asymptotic behavior as $\ensuremath{\tau}({r}_{h}\ensuremath{\rightarrow}0)=0$ and $\ensuremath{\tau}({r}_{h}\ensuremath{\rightarrow}\ensuremath{\infty})=0$ in the black hole system, which shows topological equivalency with the asymptotic behaviors $\ensuremath{\tau}({r}_{h}\ensuremath{\rightarrow}0)=\ensuremath{\infty}$ and $\ensuremath{\tau}({r}_{h}\ensuremath{\rightarrow}\ensuremath{\infty})=\ensuremath{\infty}$. We also give an intuitional proof of why there are only three topological classes in the black hole system under the condition $({\ensuremath{\partial}}_{{r}_{h}}S{)}_{P}>0$.