来自 g++ 的 String.h 错误汇编
我无法弄清楚 g++ 生成的以下 C++ 错误
/tmp/ccH0IPVU.o: In function `myAPP::mandatory_bitfield_t::to_s(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
myAPP.cpp:(.text._ZN3myAPP20mandatory_bitfield_t4to_sERSsSs[myAPP::mandatory_bitfield_t::to_s(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)]+0x8c): undefined reference to `myAPP::to_s(unsigned char*, int)'
/tmp/ccH0IPVU.o: In function `myAPP::optional_bitfield_t::to_s(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
myAPP.cpp:(.text._ZN3myAPP19optional_bitfield_t4to_sERSsSs[myAPP::optional_bitfield_t::to_s(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)]+0x8d): undefined reference to `myAPP::to_s(unsigned char*, int)'
collect2: ld returned 1 exit status
有谁知道这些错误是指什么以及如何修复它们?
I cannot make heads or tails of the following C++ error generated by g++
/tmp/ccH0IPVU.o: In function `myAPP::mandatory_bitfield_t::to_s(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
myAPP.cpp:(.text._ZN3myAPP20mandatory_bitfield_t4to_sERSsSs[myAPP::mandatory_bitfield_t::to_s(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)]+0x8c): undefined reference to `myAPP::to_s(unsigned char*, int)'
/tmp/ccH0IPVU.o: In function `myAPP::optional_bitfield_t::to_s(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
myAPP.cpp:(.text._ZN3myAPP19optional_bitfield_t4to_sERSsSs[myAPP::optional_bitfield_t::to_s(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)]+0x8d): undefined reference to `myAPP::to_s(unsigned char*, int)'
collect2: ld returned 1 exit status
Does anyone know what these errors are in reference to and how I can fix them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据链接器所知,您忘记了包含(编译)
myAPP::to_s(unsigned char*, int)
的定义。我只是翻译错误消息。
干杯&嗯。
As far as the linker knows, you have forgotten to include (compile) a definition of
myAPP::to_s(unsigned char*, int)
.I'm just translating the error message.
Cheers & hth.
这实际上是一个链接器错误。
意味着您的代码正在某处调用
to_s
方法,但该方法的主体未包含在传递给链接器的对象文件中。That is actually a linker error.
means that your code is calling the
to_s
method somewhere, but the body of this method was not included in the object files passed to the linker.