Help me, please why do I get this bug in c++?

/tmp/ccMnH16i.o: In function main': ufo.cpp:(.text+0x1c): undefined reference to greet()’
ufo.cpp:(.text+0x4b): undefined reference to rand_codeword[abi:cxx11]()' ufo.cpp:(.text+0x74): undefined reference to cwUnderscore(std::__cxx11::basic_string<char, std::char_traits, std::allocator >)’
ufo.cpp:(.text+0xc4): undefined reference to display_misses(int)' ufo.cpp:(.text+0x106): undefined reference to display_status(std::vector<char, std::allocator >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >)’
ufo.cpp:(.text+0x266): undefined reference to `end_game(std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >)’
collect2: error: ld returned 1 exit status

These are undefined reference errors (so you can google more about it later).

Without seeing the code, this could mean something is wrong with the definition, or they are just not getting linked properly (for example if you have them in a different file).

1 Like