‘VerifyNestedFlexBuffer’ is not a member of ‘flexbuffers’ [C++, gcc 11.2.0, Arch Linux, Flatbuffers v2.0.6]
technobaboo opened this issue · comments
As it says in the title, after using flatc to rebuild the flatbuffer schemas that include flexbuffers (https://github.com/StardustXR/libstardustxr/blob/main/src/common/flatbuffers/message.fbs#L9) the error below occurs:
In file included from ../src/fusion/types/data/../../../common/messenger.hpp:9,
from ../src/fusion/types/data/../../messenger.hpp:3,
from ../src/fusion/types/data/../../fusion_internal.hpp:3,
from ../src/fusion/types/data/receiver.cpp:5:
../src/fusion/types/data/../../../common/flatbuffers/message.hpp: In member function ‘bool StardustXR::Message::Verify(flatbuffers::Verifier&) const’:
../src/fusion/types/data/../../../common/flatbuffers/message.hpp:76:25: error: ‘VerifyNestedFlexBuffer’ is not a member of ‘flexbuffers’
76 | flexbuffers::VerifyNestedFlexBuffer(data(), verifier) &&
|
This issue never happened in 2.0.5.
Looks like you need to include flatbuffers.h
, see comment:
flatbuffers/include/flatbuffers/flexbuffers.h
Lines 1879 to 1889 in 1a4c405
That's the weird part, this is inside the c++ file that flatc generated by using the command
flatc -c *.fbs --gen-mutable --filename-suffix "" --filename-ext "hpp"
(see https://github.com/StardustXR/libstardustxr/blob/main/src/common/flatbuffers/message.hpp#L4-L8)
It includes the file, but still errors. Weirder still, this only ever occurs on v2.0.6 and not when reverting the flatbuffers version back to 2.0.5
If you remove the #ifdef FLATBUFFERS_H_
part does it work? I don't see anything obvious on why it isn't being linked in.
Looks like flexbuffers.h
somehow got included manually before the generated code. Can you scan where you include flexbuffers.h
and see what happens if you remove/move it to below the generated code include?
Yeah, let's leave this open for now, I'll need to look into how to do this correctly.
The problem is we ideally want to keep these headers independent.
One solution may be to just add a copy of that function to the generated code.
@technobaboo can you try out the linked PR to see if it works for you?
I am having this issue.
This is merged now, so do you have the latest code?