Linking Error (WS2_32.LIB)

Tobse tobias.m at onlinehome.de
Wed Nov 9 10:09:39 PST 2011


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


More information about the Digitalmars-d mailing list