This tutorial walks you through the creation of a simple "Hello World" application using the MoSync IDE and introduces you to some of the basic terminology we use throughout our guides, tutorials, and examples.
Start by Launching MoSync. When MoSync prompts you to select a workspace, accept the default path. The MoSync IDE will open. Close the Welcome page if it is showing.
Creating a New Project
Start by Launching MoSync. When MoSync prompts you to select a workspace, accept the default path. The MoSync IDE will open. Close the Welcome page if it is showing.
Create a new project by doing one of the following:
- From the File menu, choose New > Project, or
- Right-click in the Project Explorer, then choose New > Project
(If you have hidden the Project Explorer view, you can show it again by selecting Window > Show View > Other > General > Project Explorer and then clicking OK.)

When the New Project window opens, expand the MoSync folder:

In the folder MoSync you will find wizards for creating MoSync projects.
Select the one called MoSync Project.
Click Next.
The project name and location screen appears:

Enter the Project name "HelloWorld". Tick the Use default location box. Click Next.
MoSync Project Templates
A new window will open showing you the templates that are available for you new project:

In the MoSync IDE we provide you with several different project templates, adapted to meet the needs of various different application types:
- MoSync C Project - a standard ANSI C project template consisting of a main file with stub code
- MoSync C++ Project - a standard ANSI C++ project template consisting of a main file with stub code. The MoSync C++ utility classes in the MAUtil library are added during the build process.
- Empty MoSync Project - no main file or stub code, roll your own.
- MoSync Moblet Project - a C++ application template consisting of several project files and stub code, using the Moblet event-handling framework.
- MoSync MAUI Project - a C++ application template consisting of several project files and stub code, using the Moblet event-handling framework and the MoSync API Graphical User Interface (MAUI) classes.
In this demonstration we will use the MoSync Moblet Project template. Select it and click Finish.
Your new project will now be created from the template and loaded in the MoSync IDE:

Creating HelloWorld
Edit the code in the main.cpp file shown in the main window so that it looks like this:
#include <MAUtil/Moblet.h>
using namespace MAUtil;
class MyMoblet : public Moblet {
public:
MyMoblet() {
maSetColor(0xFFFFFF);
maDrawText(0, 32, "Hello World!");
maUpdateScreen();
}
void keyPressEvent(int keyCode, int nativeCode) {
if(keyCode == MAK_0)
{
close();
}
}
void keyReleaseEvent(int keyCode, int nativeCode) {
// todo: handle key releases
}
};
extern "C" int MAMain() {
Moblet::run(new MyMoblet());
return 0;
};Understanding Moblets
In the constructor of the MyMoblet class, we have added these lines:
maSetColor(0xFFFFFF); maDrawText(0, 32, "Hello World!"); maUpdateScreen();
The first line sets the color to white. 0xFFFFFF represents full intensity for red, green and blue. If you're not familiar with this way of representing colors you will find more information about it in the graphics tutorial.
The second line renders the text "Hello World!" to the backbuffer on the coordinates x=0 and y=32. Because it is drawing to a backbuffer, the text will not be visible directly.
The third line renders the contents of the back buffer to the screen. (If you forget to add the maUpdateScreen function to your program, you will only have a black screen!)
In the function keyPressEvent, we have added these lines:
if(keyCode == MAK_0) maExit(0);
The first line checks if the pressed key is MAK_0 (which is the zero button on your device's keypad). If that is true, the second line is executed, exiting the Moblet.
(There is also a skeleton for a function that gets notified when a key is released. Read more about the Moblet template in Event-Driven, OO Applications and learn more in our tutorial Starting a New Moblet Project.)
Your application is now ready to run.
If you would like to understand in more depth the code we just asked you to paste in, read out tutorial Hello World, Deconstructed.
Running your Application
To compile your project and run it in the MoSync emulator, click the Run button
(or Ctrl-F11):

Congratulations, you have now compiled and executed your first MoSync program!
What Next?
In our User Guides you will find extensive information about the MoSync SDK, including how to work with the Eclispse-based IDE, device profiles, bluetooth discovery and transfer, the MoRE emulator, the Debugger, the Finalizer, and MoSync's tools.
In our Programmer Guides we teach how to use MoSync's class and function libraries in your applications. We provide many step-by-step Tutorials covering all aspects of using the MoSync SDK to creating working applications. We also package a number of Example Applications with the SDK, so you can see how we do it ourselves.
At our website you can find many resources for developers, including FAQs, a developer forum, and links to our code repositories and issue tracking systems.




