objectbox / objectbox-c

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

flatbuffers.h does not found when compiling #31

Open monhi opened 1 year ago

monhi commented 1 year ago

:rotating_light: First, please check:

Describe the bug When I add include and lib to the project in windows and using Visual Studio 2013 to compile it I get an error which says it could not find "flatbuffers/flatbuffers.h"

Basic info (please complete the following information):

To Reproduce Steps to reproduce the behavior: Just try to compile the code in a Visual C++ project. Expected behavior A clear and concise description of what you expected to happen. Just I would like it to compile. Code If applicable, add code to help explain your problem.

Logs, stack traces If applicable, add relevant logs, or a stack trace.

Additional context Add any other context about the problem here.

greenrobot commented 1 year ago

To help efficiently, may I ask you to provide additional information about your setup and the location of the compiler error you are getting? For future issues, please clean up the unused text from the issue template to make it more readable. Thanks!

monhi commented 1 year ago

Please download my analyzer application from following link and try to compile it with Visual Studio 2013 or 2015 or higher. https://github.com/monhi/Online-Crypto-Analyzer I just tried to add lib and include path to the project in Debug mode and add following file to the main file.

include "./include/objectbox.hpp"

Then I try to compile the project and get for following line:

ifndef OBX_DISABLE_FLATBUFFERS // FlatBuffers is required to put data; you can disable it until have the include file.

include "flatbuffers/flatbuffers.h"

endif

which says flatbuffers.h does not found. I expect to see the above file in the include path.

to neglect the error I just comment out above include line and then try to compile the code and find other syntax errors. But for now, Please let me know if it works without flatbuffers or not. If we are supposed to add flatbuffers to make it run, isn't it better to add it to the project?

Best wishes,

greenrobot commented 1 year ago

OK, so if your setup also includes ObjectBox generator, you want to have Flatbuffers. If you want you can go with the version in the external/flatbuffers directory. You need to setup your compiler to use that directory for includes.

Btw, there is some existing documentation here: https://cpp.objectbox.io/installation#flatbuffers-optional

monhi commented 1 year ago

Let me test and inform you tomorrow