Como vincular arquivos de objeto C ++ com ld

Eu estou tentando ligar a saída de C + + usando ld e não g + +. Eu só estou fazendo isso para aprender como fazê-lo, não para fins práticos, então por favor, não sugira apenas para fazer isso com g + +.

Olhando paraessa questão, a pessoa recebe o mesmo erro ao executar o comando 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

As respostas na postagem vinculada sugerem que adicionar a biblioteca C ++ como um argumento de vinculador corrigirá o problema, então eu tentei

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

que é o que eles sugeriram, e eu também tentei muitos outros nomes de bibliotecas como libstdc ++ ou stdc ++. Mas eu sempre recebo um erro que parece

ld: cannot find -llibstd++

O que estou fazendo de errado e como posso vincular meus arquivos de objeto usando ld?

questionAnswers(1)

yourAnswerToTheQuestion