Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

Developing C/C++ Programs

You can select a topic from this diagram:

What's New Glossary Getting Started Utilities Used by the IDE Getting System Information Using Code Coverage Common Wizards Reference Preparing Your Target Developing Photon Applications Developing C/C++ Programs Where Files Are Stored Building OS and Flash Images Migrating to the 6.3 Release Tutorials IDE Concepts About This Guide Analyzing Your System With Kernel Tracing Profiling an Application Finding Memory Errors Debugging Programs Managing Source Code Launch Configurations Reference

Workflow diagram with C/C++ chapter highlighted


This chapter shows you how to create and manage your C or C++ projects.

In this chapter:

The C/C++ perspective

The C/C++ perspective is where you develop and build your projects. As indicated in the IDE Concepts chapter, a project is a container for organizing and storing your files.

Besides writing code and building your projects, you may also debug and analyze your programs from the C/C++ Development perspective.


Note: You'll find complete documentation on the C/C++ perspective, including several tutorials to help you get started, in the core Eclipse platform doc set ( Help-->Help Contents-->C/C++ Development User Guide.)

The views in the C/C++ perspective are driven primarily by selections you make in the C/C++ editor and the C/C++ Projects view, which is a specialized version of the Navigator view.

Since the Navigator view is part of the core Eclipse platform, you'll find full documentation on the Navigator view in the Workbench User Guide:

For information on the Navigator's: See these sections in the Workbench User Guide:
Toolbar and icons Concepts-->Views-->Navigator view
Right-click context menu Reference-->User interface information-->Views and editors-->Navigator View

Wizards and launch configurations

To create and run your first program, you'll use two major facilities within the IDE:

After you've used these features of the IDE for the first time, you'll be able to create, build, and run your programs very quickly. For details about wizards and launch configurations, see the Common Wizards Reference and Launch Configurations Reference chapters in this guide.

Controlling your projects

The Project Explorer view in the C/C++ perspective is perhaps the most important view in the IDE because you can use it to control your projects. The selections you make in the Project Explorer view greatly affect what information the other views show.

The Project Explorer view gives a "virtual" or filtered presentation of all the executables, source, and shared objects that comprise your project. You can set filters for the types of files you want shown in this view. For information about how to set filters, see "Filtering files."

The Project Explorer view has many of the same features as the Navigator view, but it is configured specifically for C and C++ development. At first glance, the two views may seem identical, but the Project Explorer view:

Opening files

To open files and show them in the editor area:
In the Project Explorer view, double-click the file to open.

Closing projects

If you aren't working on a project but would like to keep it in the IDE, you can close it:
In the Project Explorer, right-click your project, and then select Close Project.

Opening projects

To open a closed project:
In the Project Explorer, right-click your project, and then select Open Project.

The project opens -- you can see it in the C/C++ Projects view.

Filtering files

To hide certain files from the Project Explorer view:

  1. In the Project Explorer view, click the menu dropdown button (Icon; menu dropdown).
  2. Select Customize View... and click the Filters tab. The Available Customizations dialog appears:

    Project Explorer view; File Filter dialog

  3. On the Filters tab, select the types of files you want to hide. For example, if you select Package declarations, then all files that indicate the package to which the compilation unit belongs won't appear in the Project Explorer view.
  4. Click OK. The Project Explorer view automatically refreshes itself and shows only those files you haven't filtered.

Outlines of source and binary files

The Project Explorer view shows you an outline of the C/C++ source and header files in a project:


Project Explorer view; outline; source


Project Explorer view: outline source and header files for a project.

You can also use the Outline view to see the structure of your projects. (For more information about the Outline view, see the "Code synopsis" section in this chapter.)

The Project view shows you the outlines of binary files as well. You can examine the structure of executables or object files to see the elements that you defined or used in the file, as well as implicitly used elements, such as malloc(), _init(), and errno:


Project Explorer view; outline; executable


Project Explorer view: outline source and executable for a project.

Creating projects


Note: In earlier versions of the IDE, there were two different project types: Managed make, which automatically generated a Makefile, and Standard make, which required a Makefile in order to be built. Now, you select a project type, and that determines the build system to use.

You can continue to create a make project using the C or C++ wizard. For instructions about how to create this type of project, see "Creating the equivalent of a make project."


If you're creating an application from scratch, you'll probably want to create a QNX C Project or QNX C++ Project, which relies on the QNX recursive Makefile hierarchy to support multiple CPU targets. For more information about the QNX recursive Makefile hierarchy, see the Conventions for Makefiles and Directories chapter in the Neutrino Programmer's Guide.


Note: If you want to import an existing project, see "Importing existing source code into the IDE" in the Managing Source Code chapter in this guide.

Use the New Project wizard whenever you want to create a new project in the IDE.

Creating a simple project

To create a simple "hello world" type of program:

  1. In the C/C++ perspective, click the New C/C++ Project button in the toolbar:

    New QNX C Project button

    (You can use the dropdown menu to create different types of C/C++ projects.)

    The New Project wizard appears.


    Note: There are actually several ways to open the New Project wizard. For details about the wizards, see the Common Wizards Reference chapter in this guide.

  2. Name your project, and then select the type. For detailed information about each of the Project Types see "Creating a project" in the Getting Started chapter.

    Note: Although the wizard allows it, don't use any of the following characters in your project name:

    | ! $ ( " ) & ` : ; \ ' * ? [ ] # ~ = % < > { }

    Using these characters in a project name will cause problems later.


  3. Select a required toolchain from the Toolchain list.
  4. Click Next.
  5. Select the types of platforms and configurations you want to deploy for this project.
  6. Optional: Click Advanced Settings to edit the project's properties.
  7. Expand C/C++ Build and select Settings.
  8. Click the Binary Parsers tab.
  9. Select a parser.
  10. Select the Build Variants tab.
  11. If you want to build both debug and release variants of your program, select the build variant that matches your target type.

    If you don't want to build both debug and release variants, expand the item for your target type and disable Debug or Release.


    Note:

    If you have the Memory Analysis tool or Application Profiler tool (or both) selected for your configuration, you can set only one the debug or release variants when you create a project.

    For a managed project, to make a change to your existing variant(s), you'll need to select File-->Clean and then build again, or perform a clean before you make the change to the target variant(s).


  12. Click OK.
  13. Click Finish.

    The IDE creates your new project in your workspace. Your new project is displayed in the Project Explorer view, and in the Navigator view. If a message box prompts you to change perspectives, click Yes.

For information about converting existing projects, see "Converting a QNX project to a managed make C/C++ project" and "Converting a regular project to a managed make C/C++ project."

Creating the equivalent of a make project

You can continue to create a typical make project using the C or C++ wizard:

  1. Select File-->New-->Project, select either C-->C Project or C++-->C++ Project, and click Next.
  2. In the Project name field, type a name for your project.
  3. In the Project Types area, expand Makefile and select Empty project.
  4. In the Toolchain list, select QNX QCC.
  5. Do one of the following:

    The result is an empty make project, which is similar to the Set QNX Environment action in previous IDE releases.


Note: After you create your project, if you right-click on the project, select Properties and from the menu on the left expand C/C++ Build-->Settings, for the Runtime field on the General Settings tab, the Defaut setting refers to C++ Dinkum with exceptions.

To create a Makefile that can be launched outside the IDE:

  1. In the Target Navigator, select a project, right-click, and then select Properties.
  2. On the left, select C/C++ Build.
  3. On the right, verify that the Generate Makefiles automatically and the options Expand Env. Variable Refs in Makefiles in the group Makefile generation are selected.
  4. On the left, expand C/C++ Build, and select Tool chain editor.
  5. In the Current builder list, select the external make builder.
  6. Specify any other desirable options for properties on the other panels.
  7. Click OK.

    The IDE generates a number of .mk files, and a top-level Makefile for each processed configuration (the last one in the configuration folder). You can process this Makefile from command line using the make utility:

    make -f [configuration]/makefile [target]
  8. Every time any configuration is changed, updated, or deleted, you need to refresh the make infrastructure either by regenerating the Makefiles, or changing the existing files manually.

Choosing an indexer

The C/C++ search features use an index of symbols (from the source code in your projects, and from external header files) to find the locations of declarations and references. By default, the indexer is set to Fast, which means that it provides fastest indexing capabilities (for declarations and cross reference information). This is the recommended indexer.

To specify an indexer type for a project, open the project's Properties dialog, and then select C/C++ Indexer from the list on the left.

To specify an indexer type as the default indexer for new projects, choose Window-->Preferences..., expand C/C++ in the list on the left, and then choose Indexer.

In either case, you have the following choices:

Full indexer (complete parse)
Parses your project in the same manner that a compiler does. It starts at each compilation unit and parses that file and all files that it includes. This provides the most accurate index information. For large projects using complex C++ code, this indexer can slow down the IDE.
Fast indexer (recommended)
Similar to the Full indexer, except it parses each header file included in a project only once. For example, if a header file is included by two compilation units, the parsing of the second unit reuses the results of parsing the first unit. This is similar to how precompiled headers work. The indexing of large projects using the Fast indexer uses fewer resources than the Full indexer, but the resulting index isn't quite as accurate.
No indexer (search features will not work correctly)
Disables indexing completely. This also disables much of the search functionality.

Building projects

In this section...

After you've created a project, you'll want to build it. Note that the IDE uses the same make utility and Makefiles that are used on the command line.

The IDE can build projects automatically (i.e. whenever you change your source), or let you build them manually. When you do manual builds, you can also decide on the scope of the build.

The IDE uses a number of terms to describe the scope of the build:

Build
Build only the components affected by modified files in that particular project (i.e. make all).
Clean
Delete all the built components (i.e. .o, .so, .exe, and so on) without building anything (i.e. make clean).
Rebuild
Build the project from scratch (i.e. make clean all).

You can watch a build's progress and see output from the build command in the Console view. If a build generates any errors or warnings, you can see them in the Problems view.

Enabling the autobuild feature

By default, the IDE builds your project only when you tell it to, but it can also build your project automatically every time you change a file or other resource in any way (e.g. delete, copy, save, etc.). This feature is optimal when you have reasonably sized projects that are small in size, or not too many projects open at the same time. However, for best performance with very large projects, or if you have many open projects, you will want to leave the autobuild feature disabled.

To enable the autobuild feature:

  1. From the main menu, select Window-->Preferences.
  2. In the left pane, expand General and select Workspace.
  3. In the right pane, enable the Build automatically option.
  4. Click OK to save and apply your preferences.

    The IDE builds your projects only when you change a file or other resource.

C/C++ projects have their own autobuild setting. To set the autobuild feature for C/C++ projects:

  1. Right-click the C/C++ project, then choose Properties from the menu.
  2. Select C/C++ Make Project, and then select the Make Builder tab:

    Make Builder tab

  3. Enable the Build on resource save (Auto Build) option in the Workbench Build Behavior area.
  4. Click OK to close the project properties dialog and return to the Workbench.

Building all projects

The IDE lets you manually choose to build all your open projects. Depending on the number of projects, the size of the projects, and the number of target platforms, this could take a significant amount of time.

To build all currently open projects in the IDE:
From the main menu, select Project-->Build All.

Cleaning and rebuilding all projects

To rebuild all projects, you should clean the projects first, and then run a build:

  1. From the main menu, select Project-->Clean.... The IDE shows the Clean dialog:

    Cleaning your project

  2. Select the projects you want cleaned.
  3. Select the Start a build immediately box to enable the option.
  4. Click OK.

Building selected projects

To build selected projects:
In the Project Explorer view, right-click a project and select Build Project.

Cleaning selected projects

To clean selected projects:
In the Project Explorer view, right-click a project and select Clean Project.

Autosave before building

The IDE automatically saves all your changed resources before you do a manual build. To turn off this feature:

  1. From the main menu, select Window-->Preferences.
  2. In the left pane, expand General, and then select Workspace.

    Workbench preferences

  3. In the right pane, disable the Save automatically before build option.
  4. Click OK to save and apply your preferences.

The IDE no longer saves your resources before it builds your project.

Configuring project build order

You can instruct the IDE to build certain projects before others. If a given project refers to another project, the IDE builds that project first.


Note: Setting the build order doesn't necessarily cause the IDE to rebuild all projects that depend on a given project. You must rebuild all projects to ensure that all dependencies are resolved.

To manually configure the project build order:

  1. From the main menu, select Window-->Preferences.
  2. In the left pane, expand General, expand Workspace, and select Build Order.

    Build Order preferences

  3. Disable the Use default build order option.
  4. Select a project from the list, then click the Up or Down buttons to position the project where you want it to appear in the build order list.
  5. When you're done, click Apply, then OK.

Creating personal build options


Note: In this section, the term "targets" refers to operations that the make command executes during a build, not to target machines.

A make target is an action called by the make utility to perform a build-related task. For example, QNX Makefiles support a target named clean, which you invoke as make clean. The IDE lets you set up your own make targets (e.g. myMakeStuff). You can also use a make target to pass options such as CPULIST=x86, which causes the make utility to build only for x86. Of course, such an option would work only if it's already defined in the Makefile.

To add your own custom make target to the C/C++ Project view's right-click menu:

  1. In the Project Explorer view, right-click a project and select Create Make Target....
  2. Type the name of your make target (e.g. myMakeStuff).
  3. Click Create.

You'll see your target option listed in the Build Targets dialog, which appears when you select the Build Make Target... item from the right-click menu of the C/C++ Projects view. Your targets also appear in the Make Targets view.

To build your project with a custom make target:

  1. In the Project Explorer view, right-click a project.
  2. In the context menu, select the Build Make Target... item. The Build Targets dialog appears.
  3. Select your custom target, then click Build.

Note: To remove a make target:
  1. Open the Make Targets view (Window-->Show View-->Make Targets). Expand your project to see your make targets.
  2. Right-click the target you want to remove, and then select Delete Make Target.

Adding a use message

Adding a helpful "use" message to your application lets people receive an instant online reminder for command-line arguments and basic usage simply by typing use app_name.

Usage messages are plain text files, typically named app_name.use, which are located in the root of your application's project directory. For example, if you had the nodetime project open, its usage message might be in nodetime.use. This convention lets the recursive Makefile system automatically find your usage message data.

For information about writing usage messages, see usemsg in the Utilities Reference.

To add a usage message to your application when using a QNX C/C++ Project:

  1. In the Project Explorer view, open your project's common.mk file. This file specifies common options used for building all of your active variants.
  2. Locate the USEFILE entry.
  3. If your usage message is in app_name.use, where app_name is your executable name, add a # character at the start of the USEFILE line. This lets the recursive Makefile system automatically pick up your usage message.

    If your usage message is in a file with a different name, or you want to explicitly specify your usage message's file name, change the USAGE line as follows:

    USAGE=$(PROJECT_ROOT)/usage_message.use

    where usage_message.use is the name of the file containing your usage message. This also assumes that your usage message file is in the root of the project directory. If the usage message file is located in another directory, include it instead of $(PROJECT_ROOT).

  4. Build your project as usual to include the usage message.

To add a usage message to your application when using a Standard C/C++ Project:

  1. In the Project Explorer, open your project's Makefile.
  2. Find the rule you use to link your application's various .o files into the final executable.
  3. Add the following command to the rule after the link command:

    usemsg $@ usage_message.use

    where usage_message.use is the name of the file containing your usage message.

  4. Build your project as usual to include the usage message.

Running projects


Note: Before running an application, you must prepare your target. If it isn't already prepared, you must do so now. For information about configuring your target, see the Preparing Your Target chapter in this guide.

After you build a project, you're ready to run it. The IDE lets you run or debug your executables on a remote QNX Neutrino target machine. (For a description of remote targets, see the IDE Concepts chapter.)

To run or debug your program, you must create both of the following:


Note: For a complete description of how to create a QNX Target System Project, see the Common Wizards Reference chapter in this guide.

For a complete description of the Launch Configurations dialog and its available options, see the Launch Configurations Reference chapter in this guide.


To create a QNX Target System Project:

  1. From the menu, select File-->New-->Other....
  2. In the list, expand QNX.
  3. Select QNX Target System Project.
  4. Click Next.

    New QNX System Target project

  5. Type a name for your target.
  6. Type your target's hostname or IP address.

    Note: When you update the Target properties from the Attributes pane, your changes won't be updated if you modify the Hostname or IP address, and then click Apply. You must click OK to confirm the changes and close the properties window for the changes to take effect.

  7. Click Finish.

You'll see your new QNX Target System Project in the Navigator view.

To create a launch configuration so you can run your project:


Note: Make sure you build your project first before you create a launch configuration for it. See "Building projects" above.

  1. In the Project Explorer view, expand the Binaries folder.
  2. Right-click on your project's executable file.
  3. Select Run As-->C/C++ QNX QConn Application.

    New launch configuration

  4. In the Name field, give your launch configuration a name.
  5. In the Target Options section, select your target.
  6. Click the Run button.

Your program runs, and the IDE shows its output (if any) in the Console view.

Deleting projects

To delete a project:

  1. In the Project Explorer view, right-click a project and select Delete from the context menu. The IDE then prompts you to confirm the deletion.
  2. Decide whether you want to delete only the project framework, or the project and its contents as well.

Note: When you delete a project in the IDE, any launch configurations for that project aren't deleted. This feature lets you delete and recreate a project without also having to repeat that operation for any corresponding launch configurations you may have created.

For more on launch configurations, see the Launch Configurations Reference chapter in this guide.


Writing code

In this section...

The C/C++ editor is where you write and modify your code. As you work in the editor, the IDE dynamically updates many of the other views (even if you haven't saved your file).

C/C++ editor layout

The C/C++ editor has a gray border on each side. The marker bar might contain icons that indicate errors or other problems detected by the IDE, as well as icons for any bookmarks, breakpoints, or tasks (from the Tasks view). The icons in the left margin correspond to the line of code.


C/C++ Editor layout


The C/C++ editor.

The border on the right margin shows red and yellow bars that correspond to the errors and warnings from the Problems view. Unlike the left margin, the right margin shows the icons for the entire length of the file.

Finishing function names

The Content Assist feature can help you finish the names of functions if they're long or if you can't remember the exact spelling.

To use Content Assist:

  1. In the C/C++ editor, type one or two letters of a function's name.
  2. Press Ctrl-Space, or right-click near the cursor and select Content Assist. A menu with the available functions appears:

    C/C++ editor; Content Assist

  3. You can do one of the following:

Inserting code templates

The IDE includes another code-completion feature that can insert a template for predefined code structures, such as an empty do-while structure. If you've already used the Content Assist feature, you may have already noticed the code templates feature; you access it the same way.

To use code templates:

  1. As with Content Assist, start typing, then press Ctrl-Space, or right-click near the cursor and select Content Assist.
  2. Any code templates that match the letters you've typed show at the top of the list:

    C/C++ editor; Code Templates; using

The IDE lets you enable as many of these templates as you require, edit them as you see fit, create your own templates, and so on.

To edit a template or add one of your own:

  1. From the main menu, select Window-->Preferences.
  2. In the left pane, select C/C++-->Editor-->Templates.

    C/C++ Code Templates

  3. To edit a template, select it, and then click Edit.

    Editing a Code Template

  4. To add your own template, click New. A dialog for adding new templates is displayed:

    Adding a new Code Template

  5. In the Name field, type a name for this code template.
  6. In the Pattern field, type the code used to form the template. Click Insert Variables to insert variables into the template code.
  7. Click OK when finished.

Adding #include directives

To insert the appropriate #include directive for any documented QNX Neutrino function:

  1. In the C/C++ editor, double-click the function name, but don't highlight the parentheses, or any leading tabs or spaces.
  2. Right-click and select Source-->Add Include. The IDE automatically adds the #include statement to the top of the file, if it isn't already there.

    Add include

Hover help

The IDE's hover help feature gives you the synopsis for a function while you're coding.

To use hover help:
In the C/C++ editor, hold your pointer over a function. You'll see a text box showing the function's summary and synopsis information:


C/C++ editor; Hover help


Hover help in the C/C++ editor.

Adding and removing comments in code

You can easily add comments using either the C or C++ style, even to large sections of code. You can add two forward slash characters (//) at the beginning of lines to comment out large sections, even when they have other comment characters, such as /* */.

When you remove comments from lines, the editor removes the leading // characters from all lines that have them, so be careful not to accidentally uncomment sections. Also, the editor can comment or remove comments from selected lines -- if you highlight a partial line, the editor comments out the entire line, not just the highlighted section.

To comment or remove comments from a block of code:

  1. In the C/C++ editor, highlight a section of code to comment or remove comments. For a single line, position your cursor anywhere on that line.
  2. Right-click and select Comment or Uncomment.

Customizing the C/C++ editor

In the C/C++ editor, you can:

You can do all this using C/C++ Editor or Text Editors preference dialogs:


C/C++ editor; preferences


C/C++ editor: Preferences.

Changing fonts, background color, or the visibility of line numbers

To change fonts, background color, or to show line numbers:

  1. Open the Text Editor preferences dialog by
  2. selecting Window-->Preferences.
  3. In the left pane, select General-->Editors-->Text Editors.
  4. On the page, you can select Colors and Fonts at the bottom, or select other options, such as Appearance color options and Show line numbers.

Changing tabs into spaces, highlighting, and folding options

To change syntax highlighting, convert tabs into spaces, and change the folding options, open the C/C++ editor preferences dialog:

  1. Select Window-->Preferences.
  2. In the left pane, select C/C++-->Editor.

Setting Content Assist options

To set Content Assist options, open the Content Assist preferences dialog:

  1. Select Window-->Preferences.
  2. In the left pane, select C/C++-->Editor-->Content Assist.

Using other editors

You can use a different text editor than the one that's included with the IDE, but you'll lose the integration of the various views and perspectives. For example, within the C/C++ editor, you can set breakpoints and then see them in the Breakpoints view, or put "to-do" markers on particular lines and see them in the Tasks view, or obtain hover help as you pause your cursor over a function name in your code, and so on.

If you want to use other editors, you can do so either externally, or within the IDE.

Using an external editor outside of the IDE

You can edit your code with an editor started externally from the IDE (e.g. from the command line). When you're done editing, you'll have to synchronize the IDE with the changes.

To synchronize the IDE with the changes you've made using an external editor outside of the IDE:
In the Project Explorer view, right-click the tree pane and select Refresh. The IDE is updated to reflect any changes you've made (such as creating new files).

Using another editor within the IDE

You can specify file associations that determine the editor you want to use for each file type. For example, you can instruct the IDE to use an external program such as WordPad to edit all .h files. After you set that preference, you can double-click a file in the Project Explorer view, and the IDE automatically opens the file in your selected program.

If you have multiple associations for the same file extension, the IDE always opens the same editor, which is marked as the default in the list of editors for this extension, but other associations continue to be available. To open a file in an alternative editor, right-click on the file you want to open, select Open with-->My editor, and then choose the editor. This change means that you are also changing the default editor for this extension.

If the IDE doesn't have an association set for a certain file type, it uses the host OS defaults. For example, on a Windows host, if you double-click a .doc file, Word or WordPad is automatically launched and opens the file.


Note: For more information about file associations, follow these links in the Eclipse Workbench User Guide: Reference-->Preferences-->File Associations.

Creating files from scratch

By default, the IDE creates a simple "hello world" C/C++ source file for you, which you may or may not want to use as a template for your own code.

To create a new C/C++ file:

  1. Highlight the project that contains the new file you're creating.
  2. Click the New C/C++ Source File button on the toolbar:

    Create file button

  3. Enter (or select) the name of the folder where you want the file to reside.
  4. Name your file, then click Finish.

You'll see an empty text editor window, ready for you to begin working on your new file. Your filename appears highlighted in blue in the title bar above the editor.

More development features

In this section...

Besides the features already described above, the IDE has several other helpful facilities worth exploring.

Tracking remaining work

The Problems view provides you with a list of errors and warnings related to your projects. These are typically syntax errors, typos, and other programming errors identified by the compiler:


Problems view


The Problems view.

Error markers

The IDE also shows corresponding markers in several other locations:

Jumping to errors

To quickly go to the source of an error (if the IDE can determine where it is):
In the Problems view, double-click the error marker (Icon: Error marker) or warning marker (Icon: Warning marker). The file containing the error or warning opens in the editor area, with the cursor positioned on the offending line.

Filtering errors

Depending on the complexity and stage of your program, the IDE can generate an overwhelming number of errors. But you can customize the Problems view so you'll see only the errors you want to see.

To access the error-filtering dialog:
In the Problems view, click the Filter icon (Icon: Filter button).

The Filters dialog lets you adjust the scope of the errors shown in the Problems view. The more options you select, the more errors and warnings the IDE displays in the Problems view.


Problems view; Filters dialog


The Filters dialog, where you can select what errors are displayed in the Problems view.

Tracking tasks

The Tasks view is part of the core Eclipse platform. For more information about this view, see these links in the Workbench User Guide: Reference-->User interface information-->Views and Editors-->Tasks view.


Tasks view


The Tasks view lets you track your tasks.

Setting reminders

The Tasks view lets you create your own tasks for the unfinished function you're writing, the error-handling routine you want to check -- or for anything at all (e.g. "Pick up a loaf of bread").

To add a personal task:

  1. In the Tasks view, right-click the tasks pane and select Add Task, or click the Add Task button in the Tasks view.
  2. Complete the dialog for your task.

You can associate a task with an editable resource, for instance, to remind yourself to update a line of source code later:

To associate a task with a resource:

  1. In one of the navigation views, double-click the resource that you want to associate the new task. The resource opens in the editor area.
  2. Right-click in the gray border at the left of the editor area, beside the line of text or source code you want to log the new task against.
  3. In the pop-up menu, select Add Task.
  4. When prompted, enter a brief description of the task.

    Tasks view; New Tasks dialog with resource

Removing a task

To remove a personal task:
In the Tasks view, right-click the task and select Delete.

Code synopsis

The Outline view provides you with a structural view of your C/C++ source code:


Outline view


The Outline view shows the structural view of your source

The view shows the elements in the source file in the order they occur, including functions, libraries, and variables. You may also sort the list alphabetically, or hide certain items (fields, static members, and nonpublic members).

If you click an entry in the Outline view, the editor's cursor moves to the start of the item selected.

Checking your build

The Console view shows the output from the make utility:


C-Build view


The Console view shows the output from make.

Customizing the Console view

You can choose to clear the Console view before each new build or let the output of each subsequent build grow in the display. Whenever you perform a build, you can also have the Console view appear on top of the other stacked views.

To set the preferences for the Console view:

  1. From the main menu, select Window-->Preferences.
  2. In the left pane, select C/C++-->Build Console:


    C-Build view preferences


    The C Build Console preferences.

Accessing source files for functions

While editing source code in the editor, you can select a function name and press F3, and the editor immediately jumps to the prototype for that function (if the file is also in your project).

Press Ctrl-F3, and the editor immediately jumps to the function's implementation (if the file is also in your project).


Note: For more information about the C/C++ perspective, see the link Help-->Help Contents in the C/C++ Development User Guide.

Opening headers

To open a header file, right-click the file's name in the Outline view (for example stdio.h), and then choose Open.

Many of the enhanced source navigation (including opening header files) and code development accelerators available in the C/C++ editor are extracted from the source code. To enable these features and provide the most accurate data representation, you must properly configure the project with the include paths and define directives used to compile the source.

For QNX projects, the include paths and definitions are set automatically based on the compiler and architecture. You can set additional values in the project's properties.

For C/C++ Make projects, you must define the values yourself, either manually using the Paths and Symbols tab of the project's properties, or automatically using the Set QNX Build Environment... item in the project's context menu.

To set the include paths and define directives for a C/C++ Make project:

  1. In the Project Explorer view, right-click your project and select Properties. The Properties dialog for the selected project appears.
  2. On the left, expand C/C++ Build and select Settings. The Settings panel appears.
  3. Select the Tool settings tab.
  4. Select the appropriate compiler, language, and architecture for your project.
  5. Click Apply.
  6. On the left, expand C/C++ General and select Paths and Symbols.

    The Paths and Symbols panel appears:

    Setting path and symbol infomation

  7. Specify any required include information.
  8. Click OK.