I'm trying to implement save-file for application, by using Protocol Buffers by Google.
Preparation
A simple test .proto file has been created to test functionality:
message LessonFile {
optional string creator = 1;
}
Created .pb.cc and .pb.h are included into project. Lib and include directory are specified in project's properties.
Problem
Including newly generated code into project results application crash during runtime.
By debugging crash state, it pointed on this function:
UnknownFieldSet::UnknownFieldSet()
: fields_(NULL) {} ---------here---------
while frame above points on:
LessonFile::LessonFile()
: ::google::protobuf::Message() { ---------here---------
SharedCtor();
}
Call stack:
google::protobuf::UnknownFieldSet::UnknownFieldSet (this=0x770e3cc3)
LessonFile (this=0xba64b30) protobuf_AddDesc_LessonFile_2eproto ()
StaticDescriptorInitializer_LessonFile_2eproto (this=0x4bc108)
__static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) global constructors keyed to _Z38protobuf_AssignDesc_LessonFile_2eprotov ()
__do_global_ctors ()
__mingw_CRTStartup () WinMainCRTStartup ()
Additional info
Environment: Netbeans; Windows7-64; Qt-4.8.1 + mingw, protobuf-2.4.1.
Also there were problems with Protobuf compilation process: make check is constantly fails with this messages:
In file included from ./include/gtest/gtest-param-test.h:159:0, from ./include/gtest/gtest.h:59, from src/gtest.cc:34: ./include/gtest/internal/gtest-param-util-generated.h: In instantiation of ::operator testing::internal::ParamGenerator() const [with T = bool; T1 = bool; T2 = bool]>: ./include/gtest/gtest-param-test.h:1186:28:
required from here ./include/gtest/internal/gtest-param-util-generated.h:80:26: error: was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] In file included from ./include/gtest/gtest.h:59:0, from src/gtest.cc:34: ./include/gtest/gtest-param-test.h:288:58: note: testing::internal::ParamGenerator testing::ValuesIn(const Container&)> declared here, later in the translation unit
though libraries and protoc.exe were compiled successfully and make install created include directory and lib*.a/lib*.dll.a files.
Comments converted to an answer, for future viewers: