How to create a C/C++ project

To create a C/C++ project:


  1. From the menu, select File > New > Project… .
  2. In the left pane, select the project's nature and type according to this table:
    If you want to build a: Select:
    C Project C > C Project
    QNX C Project C > QNX C Project
    C++ Project C++ > C++ Project
    QNX C++ Project C++ > QNX C++ Project
  3. Click Next.
  4. In the Project name field, type a name for your project.
    Note: Although the wizard allows it, don't use any of the following characters in your project name:

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

    as they may cause problems later.

  5. If you don't want to use the default location for the project, ensure that the Use Default Location option is deselected, and specify where the resources reside in the filesystem (if they don't reside in your workspace).
  6. Required (when Use Default Location is not selected): In the Location field, type the path to your source (or click Browse…).
  7. Click Next.
  8. Select a type:
    • For a QNX C or C++ Project:
      • Application — A standalone executable.
      • Static library (libxx.a) — Archive of binary objects (i.e. *.o) that are directly linked against an executable.
      • Shared library (libxx.so,libxxS.a) — Combines binary objects together and joins them so that they are relocatable and can be shared by many processes.
      • Static+Static shared library (libxx.a,libxxS.a) — From one set of sources, creates static library libxxx.a and static library for shared objects libxxS.a (the same as static library, but uses position-independent code - PIC). Use this type if you want a library that will later be linked into a shared object. The System Builder uses these types of libraries to create new shared libraries that contain only the symbols that are absolutely required by a specific set of programs.
      • Shared library without export (xx.dll) — A shared library that you are not going to link with another application. Instead, it is intended to be manually opened at runtime using the dlopen() function, and other specific functions are to be looked up using the dlsym() function.

        Project type field

        If you're building a library, see Extra libraries and Extra library paths.

    • For a C++ Project:
      • Executable — Provides an executable application. This project type folder contains three templates:
        • Empty Project — A single-source project folder that doesn't contain any files.
        • Hello World C++ Project — A simple C++ application with main().

        After specifying an Executable template, the workbench creates a project with only the metadata files required for your project type, and automatically creates a makefile for you. You can modify these source files, and provide them for the project's target.

      • Shared Library — An executable module compiled and linked separately. For more information about this type, see Creating a C/C++ project.
      • Static Library — A collection of object files that you can link into another application (libxx.a). For more information about this type, see Creating a C/C++ project.
      • Makefile Project — Creates an empty project without any metadata files. For more information about this type, see Creating a C/C++ project.

      Project type field

    Note:

    When you create a shared library, it's name is recorded in a special dynamic section. You can display the information in this section to see a SONAME record. For example, you can use the following:

    ntoarm-readelf -d libname.so

    When you link against this library, your application will look for that name.

    When you perform a make install, the .so is copied to .so.1, and a .so symbolic link is created to point to it. You'll also notice that .so will get the right version. If you install a .so.2 (where the .so points to it), your old version 1 clients can still run.

  9. Select a required toolchain from the Toolchain list.

    A toolchain represents the specific tools (such as a compiler, linker, and assembler) used to build your project. Additional tools, such as a debugger, can also be associated with a toolchain. Depending on the compilers installed on your system, there might be several toolchains available to select from.

  10. Click Next.
  11. Optional: You can specify basic properties for the project, and click Next.
  12. Select the types of platforms and configurations you want to deploy for this project.

    Select platforms and configurations

  13. Optional: Click Advanced Settings... to edit' the project's properties.

    The fields for each panel are described in the Project properties section, below.

  14. Expand C/C++ Build and select Settings.
  15. Click the Binary Parsers tab.
  16. Select a parser.

    After you select the correct parser for your development environment and build your project, you can view the components of the .o file in the Project Explorer view. You can also view the contents of the .o file in the C/C++ editor.

  17. Click OK.
  18. Click Finish.

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

Depending on the type of project you choose, the New Project wizard shows a variety of different tabs that you can use to configure your new C/C++ project. For information about these tabs, see Project properties.