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.jsonfile into your IDE - Rename the
myapp.cfile 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) {
UNUSED(p);
FURI_LOG_I("MYAPP", "Hello world");
FURI_LOG_I("MYAPP", "I'm myapp!");
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) {
UNUSED(p);
FURI_LOG_I("MYAPP", "Hello world");
FURI_LOG_I("MYAPP", "I'm myapp!");
return 0;
}
#ifdef __cplusplus
};
#endifNow you have a working Flipper Zero application, written in C++.