Searching for C/C++ elements

It is recommended that you perform searches on successfully compiled programs to ensure the accuracy of search results. It is important to familiarize yourself with the correct search syntax to use to complete an effective search. It is also important to ensure that include paths and symbols are correctly defined. For more information, see Setting up include paths and macros for C/C++ indexer.

See C/C++ search, for more information on:

Performing a C/C++ Search can be done in a number of different ways but regardless of the manner chosen the same information must be provided to C/C++ Search.

The info required to do a search is:
Option Explanation
Search string this is the name of the element you are looking for. See C/C++ search for more information on how to specify wildcard searches and how to further refine your searches by using fully qualified names
Search For this is the element type that you wish to search for. You can also select to search on 'Any Element' which will perform the search on a combination of all elements
Limit To this allows you to limit your search to declarations, definitions or references. You can also select 'All Occurrences' which will search for declarations, definitions and references that match the element
Scope this allows the user to limit the scope of the search. The three available scopes are:
Workspace this searches all of the open projects in the workspace
Selected Resources this option becomes enabled whenever something is selected in one of the following views in the C/C++ perspective:
  • C/C++ Projects
  • Project Explorer
  • Search
  • Outline

The scope will be limited to whatever element is selected in the view.

Working Set working sets can be selected and created

There are 3 main ways for initiating a C/C++ search:



Using the C/C++ Search dialog

Search dialog box

  1. Enter the search string in the Search String field (optional mark it case sensitive).
    Note: that previous search queries (from the same work session) are remembered and can be accessed via the drop down list.
  2. Select the Search For element.
  3. Select the Limit To.
  4. Select the Scope.
  5. Press Search.

Results are displayed in the Search view.

Selecting an element in the Editor view

  1. Select the desired element in the editor.
  2. Right click and select All Declarations or All References and the scope you wish to search.

Results are displayed in the Search view.

Selecting an element in C/C++ Projects or Outline View

  1. Select the desired element in the tree.
  2. Right click and select All Declarations or All References and the scope you wish to search.

Results are displayed in the Search view.

For more information, see:

Related concepts
C/C++ search
C/C++ Indexer
CDT Projects
Open Declaration

Related tasks
Selection Searching for C/C++ elements
Navigate to C/C++ declarations

Related reference
C/C++ search page, Search dialog box


IBM Copyright Statement