# 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 Including paths and symbols.

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

- What you can search for
- How to limit your search
- How to use wildcard characters in your search
- Syntax examples

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:

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 Navigator 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
- Selecting an element in the Editor view
- Selecting an element in the C/C++ Projects view or Selecting an element from the Outline view

### Using the C/C++ Search dialog

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:

- Workbench User Guide > Concepts > Views > Search view
- Workbench User Guide > Concepts > Workbench > Working Set
- Workbench User Guide > Tasks > Navigating and finding resources

C/C++ search
C/C++ Indexer
CDT Projects
Open Declarations

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

C/C++ search page, Search dialog box