If the indexer gets stuck on a particular file while indexing there is a timeout watchdog, which will terminate the indexing attempt after a certain period.
This can be set as follows:
C/C++ search
C/C++ Indexer
C/C++ Indexer Problem Reporting
C/C++ Indexer Opening or Closing a project
C/C++ Indexer Progress Bar
Selection Searching for C/C++ elements
Enable/Disable the C/C++ Indexer
C/C++ Indexer Problem Reporting
Setting Source Folders
Search, C/C++ Preferences window
C/C++ search page, Search dialog box
C/C++ Project Properties, Managed, Indexer
C/C++ Project Properties, Standard, Indexer