No, it's not working > QMAKE_CXXFLAGS+= -DPROTOBUF_USE_DLLS >
Really it working when I put this #define to .pb.h file, but this file will renewed after protoc execution пятница, 17 февраля 2017 г., 18:33:48 UTC+3 пользователь pokamest nikak написал: > > Hi! I'm trying to build Qt app with protobuf 3.2. > Since Qt is dynamically linked I built protobuf as dll by configuring with > > cmake -G "NMake Makefiles" ^ >> -DCMAKE_BUILD_TYPE=Release ^ >> -Dprotobuf_BUILD_SHARED_LIBS=ON ^ >> -DCMAKE_INSTALL_PREFIX=../../../../install ^ >> ../.. >> > > Libs were included to Qt pro file > > > win32: LIBS += -L$$PWD/protobuf-windows-dynamic/lib/ -llibprotobuf >> >> INCLUDEPATH += $$PWD/protobuf-windows-dynamic/include >> >> DEPENDPATH += $$PWD/protobuf-windows-dynamic/include >> >> > > When I build my Qt app I got next errors: > >> test.pb.obj:-1: ошибка: LNK2019: ссылка на неразрешенный внешний символ >> "private: static bool >> google::protobuf::io::CodedOutputStream::default_serialization_deterministic_" >> >> (?default_serialization_deterministic_@CodedOutputStream@io@protobuf@google@@0_NA) >> >> в функции "public: static bool __cdecl >> google::protobuf::io::CodedOutputStream::IsDefaultSerializationDeterministic(void)" >> >> (?IsDefaultSerializationDeterministic@CodedOutputStream@io@protobuf@google@@SA_NXZ) >> > > >> test.pb.obj:-1: ошибка: LNK2019: ссылка на неразрешенный внешний символ >> "class google::protobuf::internal::ExplicitlyConstructed<class >> std::basic_string<char,struct std::char_traits<char>,class >> std::allocator<char> > > >> google::protobuf::internal::fixed_address_empty_string" >> (?fixed_address_empty_string@internal@protobuf@google@@3V?$ExplicitlyConstructed@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@123@A) >> >> в функции "public: __thiscall r::RouteList::RouteList(class r::RouteList >> const &)" (??0RouteList@r@@QAE@ABV01@@Z) >> > > As described in README > >> Static linking is now the default for the Protocol Buffer libraries. >> Due to >> issues with Win32's use of a separate heap for each DLL, as well as binary >> compatibility issues between different versions of MSVC's STL library, it >> is >> recommended that you use static linkage only. However, it is possible to >> build libprotobuf and libprotoc as DLLs if you really want. To do this, >> do the following: >> >> * Add an additional flag `-Dprotobuf_BUILD_SHARED_LIBS=ON` when >> invoking cmake >> * Follow the same steps as described in the above section. >> * * When compiling your project, make sure to `#define >> PROTOBUF_USE_DLLS`.* >> > > I tried to insert this #define string to several places, but #define > hadn't have any effect. > The last attempt was I made is insert this string to test.pb.h file > generated by protoc, and app was built successfully. > > But *.pb.h is not a good place to make changes. > Tell me please, where is good place to insert > > *#define PROTOBUF_USE_DLLS ?* > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
