Tutorial 1: Creating a C/C++ project

Note: The earlier versions and the current version of IDE have two different project types: Managed project and Makefile project; however, the main difference in the current version is that you'll have to provide the Makefile file for a Makefile project.

In this tutorial, you'll create a simple Makefile project.

You use the New Project wizard whenever you create a new project in the IDE. Follow these steps to create a simple hello world project:
  1. To open the New Project wizard, select File > New > Project… from the main menu of the workbench.
  2. Expand the C/C++ folder, and select C Project.

  3. Click Next.
  4. Name your project (e.g. MyFirstProject).
  5. In the Project type list, expand Makefile Project and select Empty Project.

  6. Select the QNX toolchain to build and execute on Neutrino.
    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.
  7. Click Next.

  8. Click Finish.

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

    Next, you'll create a Makefile for your project.

  9. In the Project Explorer view, highlight your project.
  10. Click the Create a File button on the toolbar:

  11. Name your file Makefile and click Finish. The editor should now open, ready for you to create your Makefile.

    Here's a sample Makefile you can use:

    CC:=qcc 
    all: hello 
    hello: hello.c 
    clean: 
            rm -f hello.o hello
    Note: Use Tab characters to indent commands inside of Makefile rules, not spaces.
  12. When you're finished editing, save your file (right-click, then select Save, or click the Save button in the tool bar).
  13. Finally, you'll create your hello world C (or C++) source file. Again, open a new file called hello.c, which might look something like this when you're done:
    #include <stdlib.h> 
    #include <stdio.h> 
    
    int main(int argc, char *argv[]) { 
       printf("Hello, world!\n"); 
    return EXIT_SUCCESS; 
    }

Congratulations! You've just created your first Make C/C++ project in the IDE.

For instructions about building your program, see the section Building projects in the Developing C/C++ Programs chapter.

Note: In order to run your program, you must first set up a Neutrino target system. For details, see: the Preparing Your Target chapter the section Running binaries for a project in the Developing C/C++ Programs chapter.