diff --git a/src/idl_gen_cpp.cpp b/src/idl_gen_cpp.cpp index 2abdca52d..e4ebff24c 100644 --- a/src/idl_gen_cpp.cpp +++ b/src/idl_gen_cpp.cpp @@ -283,6 +283,9 @@ class CppGenerator : public BaseGenerator { code_ += "#pragma clang system_header\n\n"; } + code_ += "#include \"flatbuffers/flatbuffers.h\""; + code_ += ""; + SetNameSpace(struct_def.defined_namespace); auto name = Name(struct_def); code_.SetValue("STRUCT_NAME", name); diff --git a/tests/monster_test_bfbs_generated.h b/tests/monster_test_bfbs_generated.h index 814b17eb1..e3e4887e9 100644 --- a/tests/monster_test_bfbs_generated.h +++ b/tests/monster_test_bfbs_generated.h @@ -4,6 +4,8 @@ #ifndef FLATBUFFERS_GENERATED_MONSTERTEST_MYGAME_EXAMPLE_BFBS_H_ #define FLATBUFFERS_GENERATED_MONSTERTEST_MYGAME_EXAMPLE_BFBS_H_ +#include "flatbuffers/flatbuffers.h" + namespace MyGame { namespace Example {