QuickStart in CPP - compile errors

I have a simple “hello world” cmake project into which I am adding QuickStart code. As soon as I introduce the Todo object model my project stops compiling cleanly.

.../build/_deps/cpprealm-src/include/cpprealm/macros.hpp:406:24: error: ‘managed’ is not a class template
  406 |     template <> struct managed<cls> { \
      |                        ^~~~~~~
.../build/_deps/cpprealm-src/include/cpprealm/macros.hpp:397:5: note: in expansion of macro ‘DECLARE_REALM_SCHEMA’
  397 |     DECLARE_REALM_SCHEMA(cls, false, false, ObjectType::TopLevel, __VA_ARGS__) \
      |     ^~~~~~~~~~~~~~~~~~~~
.../hello.cpp:14:1: note: in expansion of macro ‘REALM_SCHEMA’
   14 | REALM_SCHEMA(Todo, _id, name, status, ownerId);
      | ^~~~~~~~~~~~

I know there exists a CPP template app, which I have not tried yet. I was trying to add Realm support into an existing application, as this is eventually my actual plan (replacing SQLite).

Any pointers?

Hi @Doug_Reese

What platform are you using? Could you share the CMakeLists.txt for your project too?

I figured this out. I had done a copy/paste from the quick-start page, which did not have the Todo struct wrapped in namespace realm. Once I added that it compiled and ran.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.