I created a library which makes use of winsocks, I compile it with following commands:
cl /c myLib.c /link ws2_32.lib
lib myLib.obj
thus obtaining myLib.lib, everything's ok.
Now, I wrote a test program, test.c in which I do:
#include "myLib.h"
//... i use some functions //
I compile it with
cl test.c /link myLib.lib
but I get:
myLib.lib(myLib.obj) : error LNK2001: unresolved external symbol _imp_connec t@12 myLib.lib(myLib.obj) : error LNK2001: unresolved external symbol _imp_htons@ 4 myLib.lib(myLib.obj) : error LNK2001: unresolved external symbol _imp_inet_a ddr@4 myLib.lib(myLib.obj) : error LNK2001: unresolved external symbol _imp_socket @12 myLib.lib(myLib.obj) : error LNK2001: unresolved external symbol _imp_WSASta rtup@8 myLib.lib(myLib.obj) : error LNK2001: unresolved external symbol _imp_WSACle anup@0 logbus.lib(logbus.obj) : error LNK2001: unresolved external symbol _imp_closes ocket@4 test.exe : fatal error LNK1120: 7 unresolved externals
edit: Ok, if I compile adding a link to ws2_32.lib too it works. Anyway I don't like it: I already linked this library when I created mine, so I just want to link to myLib.lib...is it possibile?