Hello World Tutorial

Hi everyone.

Is there a tutorial for building an example Haiku HelloWorld app, using the command line, instead of Paladin? I mean how to compile, create the makefile etc?

Thanks a lot!!!

You can use the makefile engine that comes with Haiku. A sample Makefile is located at /boot/system/develop/etc. It is very well commented, you just have to fill out the required variables and add the sources. If you double click on your Makefile it should open with the Pe editor which has a gui mode for adding sources and resources to a Makefile.
The commands used to compile are “make” for compiling and “make clean” to clean up if needed. You can find the compiled binary in the generated objects.xxxx directory.
Feel free to ask if you run into any problems while trying it.

The other build system widely used on Haiku is jam, mostly for the system and included apps itself. But I can´t give you any help on that, as my knowledge about jam is very limited. I´m sure other community members can help you out with that if you need it.


You can look at Learning to Program with Haiku (for beginning C++) and Programming with Haiku (for intermediate C++).

1 Like

Right click in Tracker -> New -> Makefile (this is the makefile @BlueSky mentioned, but this is how you use it). Then adjust it according your needs and run “make” to build it.


Didn´t know that, that´s very convenient indeed. :+1:

1 Like

Or do it without a makefile, if your app fits in a single file there is no need for anything complex. For a graphical app you will usually just need this:

gcc hello.cpp -o hello -lbe

For example here is an app just opening an empty window that you can start from:


I have some simple sources by moscht (name=iirc) on my system, but i does not know with that license (bebits = artistic), so i can not place them online.


1 Like

Thanks a lot for your answers.
You are very supportive!!!

I have an app, i am developing for cocoa in Objective-C and later in Swift, but i never published it. I was a BeOS fun 20 years ago, and i decided to transfer the code to Haiku.

Thank you all!!!


That is one of the “well known” open source licenses: https://opensource.org/licenses/artistic-license-1.0

So it should be fine?

But without ask the author,?

It is from Maurice, so I think it’s fine. Is he still around? Anyway not the same source examples you find in: /boot/system/develop/ ?

As long as you follow the license you don’t need to ask. After all having the the ability to use and share the source is among the fundamental freedoms of open source.

Not saying you should not inform the author or ask them what they think, that’s a matter of being polite and good manners.

1 Like

edit a main.c file with this:

#include <stdio.h>
#include <stdlib.h>

int main()
    printf("Hello World!\n");
    return 0;

Save it and in the same directory launch the terminal and type:
gcc -o hello main.c
And type: