简体   繁体   English

g ++编译产生的String.h错误

[英]String.h Errors From g++ Compilation

I cannot make heads or tails of the following C++ error generated by g++ 我无法对由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

Does anyone know what these errors are in reference to and how I can fix them? 有谁知道这些错误指的是什么以及如何解决这些错误?

As far as the linker knows, you have forgotten to include (compile) a definition of myAPP::to_s(unsigned char*, int) . 据链接器所知,您忘记了包含(编译) myAPP::to_s(unsigned char*, int)

I'm just translating the error message. 我只是翻译错误消息。

Cheers & hth. 干杯和健康。

That is actually a linker error. 那实际上是一个链接器错误。

undefined reference to `myAPP::to_s(unsigned char*, int)

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. 意味着您的代码正在某处调用 to_s方法,但是此方法的主体未包含在传递给链接器的目标文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM