You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-10Lines changed: 4 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ box.put({.text = "Buy milk"});
18
18
19
19
See [ObjectBox C and C++ docs](https://cpp.objectbox.io/) for API details.
20
20
21
-
**Latest version: 4.3.1** (2025-07-28).
21
+
**Latest version: 5.0.0-rc** (2025-09-30).
22
22
See [changelog](CHANGELOG.md) for more details.
23
23
24
24
## Table of Contents:
@@ -77,20 +77,14 @@ Head over to [ObjectBox C and C++ installation docs](https://cpp.objectbox.io/in
77
77
78
78
C++ API
79
79
-------
80
-
The C++ API is built on top of the C API exposed by the library (e.g. you still need objectbox.h).
81
-
You can also use both APIs from your code if necessary.
82
-
For example, you use the C++ `obx::Box` class for most database operations, but "break out" into the C API for a special function you need.
80
+
The C++ API provides a higher level `class`-based interface built on top of the C API.
81
+
A central class is `obx::Box`, which provides most database operations.
83
82
Note that to use the `obx::Box` class, you also need the [ObjectBox Generator](https://github.com/objectbox/objectbox-generator) to generate binding code.
84
83
Find more details how to use it the [Getting started](https://cpp.objectbox.io/getting-started) section of the docs.
85
84
86
85
Examples
87
86
--------
88
-
Have a look at the following TaskList example apps, depending on your programming language and preference:
89
-
90
-
* [C, cursor, no generated code](examples/c-cursor-no-gen) - plain C; using flatcc directly; without any generated code
91
-
* [C, with generated code](examples/c-gen) - plain C, using code generated by `objectbox-generator`
92
-
* [C++, with generated code](examples/cpp-gen) - C++, using code generated by `objectbox-generator`
93
-
* also includes sync client application example
87
+
Check the [examples](examples) directory for self-contained examples that show how to use the C and C++ APIs.
Each example is self-contained in its own subdirectory and can be built using CMake.
7
+
For convenience, a `build.sh` script is provided in each example directory,
8
+
which puts all build files into a separate directory ("build/").
9
+
See the [build and run](#build-and-run) section below for details.
10
+
11
+
## Tasks Examples
12
+
13
+
There are four examples console applications that implement a simple task list.
14
+
Tasks can be added, viewed, and marked as finished to demonstrate typical ObjectBox database operations.
15
+
16
+
The examples for C++ are:
17
+
18
+
-`tasks`: C++ application
19
+
-`tasks-sync`: C++ application with sync enabled (requires a ObjectBox Sync server)
20
+
21
+
The examples for C are:
22
+
23
+
-`c-tasks`: C application
24
+
-`c-tasks-lowlevel`: C application, but with lesser used lower-level APIs; not the best to start with
25
+
26
+
## Vector Search Example
27
+
28
+
There's a C++ example for vector search in the [vectorsearch-cities](vectorsearch-cities/README.md) directory.
29
+
30
+
## Build and run
31
+
32
+
Prerequisites are CMake 3.14+ and a C/C++ compiler.
33
+
All examples follow the same setup, and thus we document it only once here.
34
+
35
+
### Build with the provided shell script
36
+
37
+
This is the simplest way on Linux and macOS from the command line.
38
+
39
+
* Typically, you `cd` into an example directory and run `./build.sh` (each example has its own `build.sh`).
40
+
* Once the build is done, you can run the example: the executable is in the `build/` directory and its path is printed to the console during the build.
41
+
* Run `./build.sh run` to build and run the example in one step.
42
+
* The `./build.sh` also accepts `--clear` as the first argument to clear the build directory before building.
43
+
44
+
### Build within IDEs (CMake)
45
+
46
+
If you work with a IDE, you can typically just open each example as a CMake project.
47
+
The IDE will setup everything for you.
48
+
49
+
### Build with CMake
50
+
51
+
If you prefer to use CMake directly (e.g. on a Windows terminal), you can do so as follows:
52
+
53
+
```
54
+
cmake -S . -B build
55
+
cmake --build build
56
+
```
57
+
58
+
And then run the built executable:
59
+
60
+
```
61
+
build/objectbox-examples-... # replace ... with the example name
62
+
```
63
+
64
+
## Next steps
65
+
66
+
If you want, you can copy an example as a starting point for your own project.
67
+
Pick the directory of the example that fits best for your needs.
68
+
69
+
Links and documentation:
70
+
71
+
*[ObjectBox homepage](https://objectbox.io/)
72
+
*[ObjectBox C and C++ docs](https://cpp.objectbox.io/)
0 commit comments