문제linker input file unused because linking not done

1260 단어 IDE 및 GNU 툴체인

> When I try to compile using the makefile, it gives me the 

> error : 
>>make > gcc -Wall -c client1.c 
> gcc -Wall -c -lsocket -lnsl libfile1.c 
> gcc: -lsocket: linker input file unused because linking not done 
> gcc: -lnsl: linker input file unused because linking not done 
> ar -crvs libshm.a libfile1.o 
> r - libfile1.o > ar: writing libshm.a 
> gcc -Wall client1.o -L. -lshm -o client1  
> Can anybody tell me what the "linker input file unused cus linking not 
> done " error means ??????????  

In the command for this target: libshm.a : libfile1.o     
gcc -Wall -c -lsocket -lnsl libfile1.c  
you're compiling only because you have the -c flag. 
No linking takes place, so gcc is informing you that it is ignoring the -lsocket and -lnsl linker flags. 
You don't need them in that command.  
All of the linking takes place in the command for this target: client1: client1.o libshm.a     
gcc -Wall client1.o -L. -lshm -o client  
Here you will want to use -lsocket and -lnsl because you're linking all of the parts into an executable, 
so you can't leave anything out.

좋은 웹페이지 즐겨찾기