Linking Error (WS2_32.LIB)
newshound2 at digitalmars.com
Thu Nov 10 11:46:27 PST 2011
On 11/9/2011 10:09 AM, Tobse wrote:
> 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.
> Error 42: Symbol Undefined _D3std6socket7Address8toStringMFZAya
> Error 42: Symbol Undefined _D3std6socket7Address13addressFamilyMFZE3std6socket1
> Error 42: Symbol Undefined _D3std6socket7Address7nameLenMFZi
> Error 42: Symbol Undefined _D3std6socket7Address4nameMFZPS3std1c7windows7winsoc
> --- errorlevel 4
To compile main.d and link with ws2_32.lib,
dmd main.d ws2_32.lib
will work. However, that is not the problem you're having. There's clearly a
mismatch between the phobos.lib you're linking with and the std.socket being
read by the compiler. One is out of date with the other.
In other words, the undefined symbols reported by the linker appear in
std.socket but do not appear in phobos.lib.
More information about the Digitalmars-d