Installation
The ObjectBox C / C ++ database is setup within minutes. Get the library and the generator and start developing high performance data applications.
ObjectBox library
There are a couple of ways to get the ObjectBox library (we recommend CMake 3.14 or newer):
Use CMake's FetchContent to get ObjectBox headers and library ready to use in your project:
If you want to use an ObjectBox Sync variant of the library, change the target_link_libraries
to:
Supported Platforms: Linux (x86_64, aarch64, armv7hf, armv6hf), macOS (x64,arm64), Windows (x64,x86) On Windows you might have to install the latest Microsoft Visual C++ Redistributable package (X64) to use the ObjectBox DLL. Support for other platforms and architectures on request (i.e. QNX, armv6)
Once you setup the headers and library like this, you can already start using the ObjectBox API! Here's a minimal example to verify your setup:
#define OBX_CPP_FILE
is not strictly required in this minimal example. However, when starting with the real C++ API, it is required to have exactly one .cpp file that defines OBX_CPP_FILE right before the inclusion of the "objectbox.hpp" header.
If you used CMake to setup your project you can already build and execute this program. Otherwise ensure your includes and the runtime shared library (libobjectbox.so, .dylib, .dll depending on the platform) are setup correctly for your compiler and linker environment.
ObjectBox Generator
ObjectBox Generator is a tool that will help you with during development of your application (and as opposed to the ObjectBox shared library, it's not supposed to be distributed with your app).
Using the ObjectBox Generator with CMake is straightforward (after the installation via FetchContent
above):
For more details, please refer to the Generator documentation page.
FlatBuffers
ObjectBox uses FlatBuffers to represent objects at lower levels. It is a highly efficient binary representation that works across platforms. For advanced usage, you can opt to work with FlatBuffers directly.
If you are using the recommended CMake's FetchContent ObjectBox setup, there's no FlatBuffers setup required. You can skip this section.
Last updated