Reputation: 4555
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?
Upvotes: 0
Views: 281
Reputation: 88468
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.
Upvotes: 3
Reputation: 145429
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.
Upvotes: 4