using winsock2

akcom CppCoder at gmail.com
Wed Nov 15 09:47:36 PST 2006


Hello, I'm currently trying to build a project that uses winsock2 (from 
http://www.prowiki.org/wiki4d/wiki.cgi?WindowsAPI) but I'm having some 
problems.

My code is very basic, something along the lines of:

import win32.core;
import win32.windows;
import win32.winsock2;

void main()
{
    WSADATA wsa;
    WSAStartup( MAKEWORD( 2, 2 ), &wsa );
    //nothing important
    WSACleanup();
}

I am building it using the following command:
dmd -IC:\dmd\src\other -version=Win32_Winsock2 main.d ws2_32.lib
the compiler gives the following complaints:
main.obj(main)
 Error 42: Symbol Undefined __init_5win328winsock27WSADATA
main.obj(main)
 Error 42: Symbol Undefined _D5win326windef8MAKEWORDFhhZt
main.obj(main)
 Error 42: Symbol Undefined WSASTARTUP
main.obj(main)
 Error 42: Symbol Undefined WSACLEANUP

if I add C:\dmd\src\other\win32\winsock2.d to the list of files to compile, 
I get no complaints about
 Error 42: Symbol Undefined _D5win326windef8MAKEWORDFhhZt

any ideas?





More information about the Digitalmars-d-learn mailing list