Simply add the library as a git submodule to your project with
git submodule add https://github.com/MadLadSquad/UntitledFlipperZero UFZ
.
Once you run ufbt
, an appropriate
compile_commands.json
file will be generated, which you can
use to build your project.
Creating an application
To create an application, do the following:
- Install
ufbt
- Run
ufbt create APPID=myapp
- Load the
.vscode/compile_commands.json
file into your IDE - Rename the
myapp.c
file tomyapp.cpp
Setting up the entry point
When you first open myapp.cpp
, you're going to be
presented with code similar to this:
#include <furi.h>
/* generated by fbt from .png files in images folder */
#include <myapp_icons.h>
int32_t myapp_app(void* p) {
(p);
UNUSED("MYAPP", "Hello world");
FURI_LOG_I("MYAPP", "I'm myapp!");
FURI_LOG_I
return 0;
}
This will not work in C++, however, due to name mangling. To fix it,
add it to an extern C
block, like this:
#include <furi.h>
/* generated by fbt from .png files in images folder */
#include <myapp_icons.h>
#ifdef __cplusplus
extern "C"
{
#endif
int32_t myapp_app(void* p) {
(p);
UNUSED("MYAPP", "Hello world");
FURI_LOG_I("MYAPP", "I'm myapp!");
FURI_LOG_I
return 0;
}
#ifdef __cplusplus
};
#endif
Now you have a working Flipper Zero application, written in C++.