-Wl,--as- needed a.cpp -L. -ld -lb # wrong order (like static libs) $ g++ ...
The linker is almost always invoked through the compiler driver gcc
Always link object files before libraries, period. The trouble is that the linker scans the library, and it is looking for main() . It doesn't find it, so it doesn't pull ...
This means that a library containing the definition of a function should appear after any source files or object files which use it. This includes libraries specified ...
/usr/ccs/bin/ld
You need this special case of the -l option in order to link an Objective-C or ...
as the result of linking the file /lib/crt0.o with hello.o and the library libc.a , which will come
When linking object files (static libraries) into an executable, the order in which you give the libraries matters. For simple scenarios where there ...
case of the -l option in order to link an Objective-C or Objective-C++ program.
The linker searches from left to right.