2

现在我在qnx中使用GPB开发测试代码如下:

Offer_event Offer;
string a = "127.0.0.7";

Offer.set_ipaddress(a);
Offer.set_port(9000);

      BufSize = Offer.ByteSize();

Length_message = BufSize + Message_Header_Size;
Message->PayloadLength_of_Payload = BufSize;
PayloadBuffer = new char[BufSize];
Offer.SerializeToArray(PayloadBuffer, BufSize);

在那种情况下,我遇到了一些错误。但我无法理解。

该错误如下:

#0  std::string::size (this=0xcd21c0)
at /home/builder/hudson/650-gcc-4.4/svn/linux-x86-o-ntoarmeabi/arm-unknown-nto-qnx6.5.0eabi/pic/libstdc++-v3/include/bits/basic_string.h:624
624     /home/builder/hudson/650-gcc-4.4/svn/linux-x86-o-ntoarmeabi/arm-unknown-
nto-qnx6.5.0eabi/pic/libstdc++-v3/include/bits/basic_string.h: No such file or d
irectory.
in /home/builder/hudson/650-gcc-4.4/svn/linux-x86-o-ntoarmeabi/arm-unkno
wn-nto-qnx6.5.0eabi/pic/libstdc++-v3/include/bits/basic_string.h
(gdb) bt
#0  std::string::size (this=0xcd21c0)
at /home/builder/hudson/650-gcc-4.4/svn/linux-x86-o-ntoarmeabi/arm-unknown-n
to-qnx6.5.0eabi/pic/libstdc++-v3/include/bits/basic_string.h:624
#1  0x0067d6b0 in google::protobuf::internal::WireFormatLite::StringSize ()
#2  0x0063ecd0 in Offer_event::ByteSize ()
#3  0x00404f18 in AnalysisCmdC_Actor::TestGPB ()

from C:/QNX650/target/qnx6/armle-v7/lib/libc.so.3
#11 0x0004201a in ?? ()
Cannot access memory at address 0x0
Current language:  auto; currently c++
(gdb)

我不知道为什么 ByteSize 有问题。如果我删除字符串部分,它工作得很好。我认为字符串的使用是问题。

有什么问题?

4

0 回答 0