Tutorial 1: Create a C/C++ 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, from the workbench main menu, select File > New > C Project

    New Project Wizard: Select a project type

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

    New Project Wizard: Select a project type

  4. Select the QNX toolchain to build and execute on QNX 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.
  5. Click Next, then Finish.

    New Project Wizard: finish up

    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.

    If you don't see your project, click on the Project Explorer tab.

    New Project Wizard: finish up

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

  6. In the Project Explorer view, highlight your project.
  7. Click the New C/C++ Source File button on the toolbar:

  8. Name your file Makefile, make sure the Template is set to <none>, then click Finish.

    Create the Makefile

  9. Double click on your new file to open it in the editor and write what you need in the file.

    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.
  10. When you're finished editing, save your file (right-click, then select Save, or click the Save button in the tool bar).
  11. Finally, you'll create your hello world C (or C++) source file. Again, click the New C/C++ Source File button on the toolbar, select Source File and the Default C source template, and name your file hello.c.

    Create a C file.

  12. Open the file and write your "Hello world!" program.

    Your hello.c file 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 QNX Neutrino target system. For details, see the "Preparing Your Target" chapter.