When I tried to use gcc command to compile a test program with a static library 't1' which archive by myself.
The command I use to archive static library like this:
ar rcv libt1.a t1.o
Use the following command got An error:
gcc -L. -static -lt1 t.c -o t
ld: library not found for -lcrt0.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
But, If I remove '-static' like this:
gcc -L. -lt1 t.c -o t
It compile successfully. And I got the right result.
But I search a lot, find out other guys use '-static', and they do not get an error. So, please help me figure that.