-
-
Notifications
You must be signed in to change notification settings - Fork 0
Building
Stanislav Vasilev edited this page Jun 16, 2024
·
3 revisions
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.
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
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
};
#endif
Now you have a working Flipper Zero application, written in C++.
This project is supported by all the people who joined our discord server and became beta testers. If you want to join the discord you can click here.