Searching for C/C++ elements

The Stand-alone Debugger provides the ability to search through the source code of your application. To do this, the Debugger indexes the source code using the include paths and macros used to build the application. If your application is built using the default include paths and no additional user-defined flags, then there is nothing you need to do to make the search work accurately. In the case where your application has additional include paths and user-defined flags specified in the build, you need to either use the -g3 flag to include macro information or else you need to provide the Stand-alone Debugger with a copy of the build log. The build log can be provided on the command line using the -b option or via the File > New Executable... dialog. If you do not set this up properly, various operations such as searching, type hierarchy, and hover display may be inaccurate.

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.

Related concepts
C/C++ search
C/C++ Indexer
C/C++ 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