Linking Error (WS2_32.LIB)

Nick Sabalausky a at a.a
Wed Nov 9 10:36:08 PST 2011


"Tobse" <tobias.m at onlinehome.de> wrote in message 
news:j9efl3$2igk$1 at digitalmars.com...
> Hey,
> i wanted to write a basic cli chat to get familiar with d. So i looked up 
> the
> default library for sockets and found std.socket; There is a note that 
> says
> "compile with ws2_32.lib". When i simply run:
>
> dmd main.d
>
> it tells me:
>
> OPTLINK (R) for Win32  Release 8.00.12
> Copyright (C) Digital Mars 1989-2010  All rights reserved.
> http://www.digitalmars.com/ctg/optlink.html
> dist\client.obj(client)
> Error 42: Symbol Undefined _D3std6socket7Address8toStringMFZAya
> dist\client.obj(client)
> Error 42: Symbol Undefined 
> _D3std6socket7Address13addressFamilyMFZE3std6socket1
> 3AddressFamily
> dist\client.obj(client)
> Error 42: Symbol Undefined _D3std6socket7Address7nameLenMFZi
> dist\client.obj(client)
> Error 42: Symbol Undefined 
> _D3std6socket7Address4nameMFZPS3std1c7windows7winsoc
> k8sockaddr
> --- errorlevel 4
>
> So then i tried this:
>
> dmd main.d -Llib ws2_32.lib
>
> But i keep getting the exact same error plus
>
> OPTLINK : Warning 9: Unknown Option : NOILIB
>
> doing this:
>
> dmd main.d
> link client.obj -lib ws2_32.lib
>
> Its the same again plus
>
> OPTLINK : Warning 9: Unknown Option : LIB
>
>
> Can somone please tell me how to link the compiled code correctly so that 
> i
> can run it? Or is this a bug?
>
> Greets, Tobi

Not sure whether or not there's some other problem, but try this:

dmd main.d ws2_32.lib




More information about the Digitalmars-d mailing list