objectbox / objectbox-c

C and C++ database for objects and structs
https://objectbox.io/
Apache License 2.0
194 stars 35 forks source link

error:no matching function for call to 'obx::Box<Task>::put(<brace-enclosed initializer list>) #7

Closed Laganer closed 3 years ago

Laganer commented 3 years ago

when I compile the example by running: g++ main.cpp -I. -std=c++11 -lobjectbox error:no matching function for call to 'obx::Box::put()

obx_id id = box.put({.text = "Buy milk"}) ^

int main() { obx::Store store(create_obx_model()); obx::Box box(store);

obx_id id = box.put({.text = "Buy milk"});  //  error code

std::unique_ptr task = box.get(id); // Read if (task) { task->text += " & some bread"; box.put(*task); // Update box.remove(id); // Delete } return 0; }

vaind commented 3 years ago

I've just tested the example you're probably referring to (https://cpp.objectbox.io/getting-started) and it worked for me - I've got no error.

Could you maybe zip the whole directory you've tried this in and attach it to the issue? So I can try to run the exact same code. Also, what platform and compiler are you using? uname -a and g++ --version

Laganer commented 3 years ago

Thanks for your reply !

I've just tested the example you're probably referring to (https://cpp.objectbox.io/getting-started) and it worked for me - I've got no error.

Could you maybe zip the whole directory you've tried this in and attach it to the issue? So I can try to run the exact same code? Also, what platform and compiler are you using? uname -a and g++ --version

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

vaind commented 3 years ago

Looks like the getting-started page answered the questions. Feel free to follow-up in case there's still an issue.