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:
-
To open the New Project wizard, select from the main menu of the workbench.
-
Expand the C/C++ folder, and select C Project.
-
Click Next.
-
Name your project (e.g. MyFirstProject).
-
In the Project type list, expand Makefile Project and select Empty Project.
-
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.
-
Click Next.
-
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.
-
In the Project Explorer view, highlight your project.
-
Click the Create a File button on the toolbar:
-
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.
-
When you're finished editing, save your file (right-click, then select Save, or click the Save button in the tool bar).
-
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.