Jak połączyć pliki obiektowe C ++ z ld

Próbuję połączyć wyjście C ++ przy użyciu ld, a nie g ++. Robię to tylko po to, by nauczyć się tego robić, nie w celach praktycznych, więc proszę nie sugerować, aby to zrobić za pomocą g ++.

Patrzeć nato pytanie, osoba dostaje ten sam błąd po uruchomieniu komendy ld:

$ ld test.o -o test.out
ld: warning: cannot find entry symbol _start; defaulting to 00000000004000e8
test.o: In function `main':
test.cpp:(.text+0x1c): undefined reference to `strcasecmp'
test.cpp:(.text+0x23): undefined reference to `std::cout'
test.cpp:(.text+0x28): undefined reference to `std::ostream::operator<<(int)'
test.cpp:(.text+0x2d): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
test.cpp:(.text+0x35): undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
test.o: In function `__static_initialization_and_destruction_0(int, int)':
test.cpp:(.text+0x75): undefined reference to `std::ios_base::Init::Init()'
test.cpp:(.text+0x7a): undefined reference to `__dso_handle'
test.cpp:(.text+0x84): undefined reference to `std::ios_base::Init::~Init()'
test.cpp:(.text+0x89): undefined reference to `__cxa_atexit'
ld: test.out: hidden symbol `__dso_handle' isn't defined
ld: final link failed: Bad value

Odpowiedzi w połączonym poście sugerują, że dodanie biblioteki C ++ jako argumentu linkera rozwiąże problem, więc spróbowałem

ld test.o -o test.out -llibstd++

co sugerowali, a także wypróbowałem wiele innych nazw bibliotek, takich jak libstdc ++ lub stdc ++. Ale zawsze będę miał błąd, który wygląda

ld: cannot find -llibstd++

Co robię źle i jak mogę połączyć moje pliki obiektów za pomocą ld?

questionAnswers(1)

yourAnswerToTheQuestion