| Winsock Home | Part 1 | Part 2 | Tenouk.com |


 

 

 

 

 

 

C, Winsok2 and Visual Studio 2008 (VC++) Professional Edition:

The How-to Build Guide Part 2

 

 

 

 

 

In our case, the winsok2.h header file was found and used under the

 

C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winsock2.h

 

Depending on the VS version that you use, the path may be different, however the file name should be the same. The following is a complete dump of the output.

 

 

 

 

 

 

 

 

 

 

 

 

1>------ Rebuild All started: Project: Winsock2sample, Configuration: Debug Win32 ------

1>Deleting intermediate and output files for project 'Winsock2sample', configuration 'Debug|Win32'

1>Compiling...

1>Winsock2samplesrc.cpp

1>Note: including file: C:\Program Files\Microsoft Visual Studio 9.0\VC\include\stdio.h

1>Note: including file:  C:\Program Files\Microsoft Visual Studio 9.0\VC\include\crtdefs.h

1>Note: including file:   C:\Program Files\Microsoft Visual Studio 9.0\VC\include\sal.h

1>Note: including file:    c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h

1>Note: including file:   C:\Program Files\Microsoft Visual Studio 9.0\VC\include\crtassem.h

1>Note: including file:   C:\Program Files\Microsoft Visual Studio 9.0\VC\include\vadefs.h

1>Note: including file:  C:\Program Files\Microsoft Visual Studio 9.0\VC\include\swprintf.inl

1>Note: including file: C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winsock2.h

1>Note: including file:  C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\windows.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\sdkddkver.h

1>Note: including file:   C:\Program Files\Microsoft Visual Studio 9.0\VC\include\excpt.h

1>Note: including file:    C:\Program Files\Microsoft Visual Studio 9.0\VC\include\crtdefs.h

1>Note: including file:   C:\Program Files\Microsoft Visual Studio 9.0\VC\include\stdarg.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\windef.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winnt.h

1>Note: including file:     C:\Program Files\Microsoft Visual Studio 9.0\VC\include\ctype.h

1>Note: including file:      C:\Program Files\Microsoft Visual Studio 9.0\VC\include\crtdefs.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\specstrings.h

1>Note: including file:      C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\specstrings_adt.h

1>Note: including file:      C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\specstrings_strict.h

1>Note: including file:       C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\specstrings_undef.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\basetsd.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\guiddef.h

1>Note: including file:      C:\Program Files\Microsoft Visual Studio 9.0\VC\include\string.h

1>Note: including file:       C:\Program Files\Microsoft Visual Studio 9.0\VC\include\crtdefs.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack4.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:     c:\program files\microsoft sdks\windows\v6.0a\include\pshpack4.h

1>Note: including file:     c:\program files\microsoft sdks\windows\v6.0a\include\pshpack2.h

1>Note: including file:     c:\program files\microsoft sdks\windows\v6.0a\include\poppack.h

1>Note: including file:     c:\program files\microsoft sdks\windows\v6.0a\include\pshpack2.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack2.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:     c:\program files\microsoft sdks\windows\v6.0a\include\poppack.h

1>Note: including file:     c:\program files\microsoft sdks\windows\v6.0a\include\pshpack8.h

1>Note: including file:     c:\program files\microsoft sdks\windows\v6.0a\include\poppack.h

1>Note: including file:     c:\program files\microsoft sdks\windows\v6.0a\include\poppack.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\ktmtypes.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winbase.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winerror.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\wingdi.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack1.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack2.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack2.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack4.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack4.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winuser.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack2.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\tvout.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winnls.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\wincon.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winver.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winreg.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\reason.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winnetwk.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\cderr.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\dde.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\ddeml.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\dlgs.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\lzexpand.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\mmsystem.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack1.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\nb30.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\rpc.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\rpcdce.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\rpcdcep.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\rpcnsi.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\rpcnterr.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\rpcasync.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\shellapi.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack1.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winperf.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack8.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winsock.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\wincrypt.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\bcrypt.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\ncrypt.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\bcrypt.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winefs.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winscard.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\wtypes.h

1>Note: including file:     c:\program files\microsoft sdks\windows\v6.0a\include\rpcndr.h

1>Note: including file:      C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack8.h

1>Note: including file:      C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\rpcnsip.h

1>Note: including file:      C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\rpcsal.h

1>Note: including file:      C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:     c:\program files\microsoft sdks\windows\v6.0a\include\guiddef.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winioctl.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack1.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack1.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack1.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack1.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack1.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack1.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:    c:\program files\microsoft sdks\windows\v6.0a\include\winsmcrd.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winspool.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\prsht.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack4.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\ole2.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack8.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objbase.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack8.h

1>Note: including file:     C:\Program Files\Microsoft Visual Studio 9.0\VC\include\stdlib.h

1>Note: including file:      C:\Program Files\Microsoft Visual Studio 9.0\VC\include\crtdefs.h

1>Note: including file:      C:\Program Files\Microsoft Visual Studio 9.0\VC\include\limits.h

1>Note: including file:       C:\Program Files\Microsoft Visual Studio 9.0\VC\include\crtdefs.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\unknwn.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\guiddef.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\cguid.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\urlmon.h

1>Note: including file:      c:\program files\microsoft sdks\windows\v6.0a\include\oleidl.h

1>Note: including file:      c:\program files\microsoft sdks\windows\v6.0a\include\servprov.h

1>Note: including file:      c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h

1>Note: including file:       c:\program files\microsoft sdks\windows\v6.0a\include\oaidl.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\propidl.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\oleauto.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack8.h

1>Note: including file:     C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\commdlg.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\prsht.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\pshpack1.h

1>Note: including file:    C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\poppack.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\stralign.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winsvc.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\mcx.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\imm.h

1>Note: including file:  C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\ws2def.h

1>Note: including file:   C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\inaddr.h

1>Note: including file:  C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\qos.h

1>Compiling manifest to resources...

1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0

1>Copyright (C) Microsoft Corporation.  All rights reserved.

1>Linking...

1>Starting pass 1

1>Processed /DEFAULTLIB:uuid.lib

1>Processed /DEFAULTLIB:MSVCRTD

1>Processed /DEFAULTLIB:OLDNAMES

1>Searching libraries

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\kernel32.lib:

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\user32.lib:

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\gdi32.lib:

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\winspool.lib:

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\comdlg32.lib:

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\advapi32.lib:

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\shell32.lib:

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\ole32.lib:

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\oleaut32.lib:

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\uuid.lib:

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbc32.lib:

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbccp32.lib:

1>    Searching C:\Program Files\Microsoft Visual Studio 9.0\VC\lib\MSVCRTD.lib:

1>      Found __imp__printf

1>        Referenced in Winsock2samplesrc.obj

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found ___security_cookie

1>        Referenced in Winsock2samplesrc.obj

1>        Loaded MSVCRTD.lib(gs_cookie.obj)

1>      Found @__security_check_cookie@4

1>        Referenced in Winsock2samplesrc.obj

1>        Loaded MSVCRTD.lib(secchk.obj)

1>      Found @_RTC_CheckStackVars@8

1>        Referenced in Winsock2samplesrc.obj

1>        Loaded MSVCRTD.lib(_stack_.obj)

1>      Found __RTC_Shutdown

1>        Referenced in Winsock2samplesrc.obj

1>        Loaded MSVCRTD.lib(_init_.obj)

1>      Found _mainCRTStartup

1>        Loaded MSVCRTD.lib(crtexe.obj)

1>      Found __IMPORT_DESCRIPTOR_MSVCR90D

1>        Referenced in MSVCRTD.lib(MSVCR90D.dll)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found ___report_gsfailure

1>        Referenced in MSVCRTD.lib(secchk.obj)

1>        Loaded MSVCRTD.lib(gs_report.obj)

1>      Found "void __cdecl _RTC_Failure(void *,int)" (?_RTC_Failure@@YAXPAXH@Z)

1>        Referenced in MSVCRTD.lib(_stack_.obj)

1>        Loaded MSVCRTD.lib(_error_.obj)

1>      Found __RTC_SetErrorFuncW

1>        Referenced in MSVCRTD.lib(_init_.obj)

1>        Loaded MSVCRTD.lib(_userapi_.obj)

1>      Found __CRT_RTC_INITW

1>        Referenced in MSVCRTD.lib(_init_.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found ___CxxSetUnhandledExceptionFilter

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(unhandld.obj)

1>      Found __imp___configthreadlocale

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found ___globallocalestatus

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(xthdloc.obj)

1>      Found __setdefaultprecision

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(fp8.obj)

1>      Found __imp____setusermatherr

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found __matherr

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(merr.obj)

1>      Found __setargv

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(dllargv.obj)

1>      Found __RTC_Initialize

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(_initsect_.obj)

1>      Found __adjust_fdiv

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(adjustfd.obj)

1>      Found __imp___adjust_fdiv

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found __commode

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(xncommod.obj)

1>      Found __imp____p__commode

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found __fmode

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(xtxtmode.obj)

1>      Found __imp____p__fmode

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found ___onexitbegin

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(atonexit.obj)

1>      Found __imp___encode_pointer

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Referenced in MSVCRTD.lib(atonexit.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found __imp____set_app_type

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found __amsg_exit

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found __imp____getmainargs

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found __dowildcard

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(wildcard.obj)

1>      Found __newmode

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(_newmode.obj)

1>      Found ___security_init_cookie

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(gs_support.obj)

1>      Found __imp___exit

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found __XcptFilter

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found __imp___cexit

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found __imp__exit

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found __imp____initenv

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found __imp___CrtSetCheckCount

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found __IsNonwritableInCurrentImage

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(pesect.obj)

1>      Found __imp___CrtDbgReportW

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found __initterm

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found ___xc_a

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(cinitexe.obj)

1>Processed /DEFAULTLIB:kernel32.lib

1> Processed /DISALLOWLIB:libc.lib

1> Processed /DISALLOWLIB:libcd.lib

1> Processed /DISALLOWLIB:libcmt.lib

1> Processed /DISALLOWLIB:libcmtd.lib

1> Processed /DISALLOWLIB:msvcrt.lib

1>      Found __initterm_e

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found ___native_startup_state

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded MSVCRTD.lib(natstart.obj)

1>      Found __except_handler4

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Referenced in MSVCRTD.lib(_error_.obj)

1>        Referenced in MSVCRTD.lib(atonexit.obj)

1>        Referenced in MSVCRTD.lib(pesect.obj)

1>        Loaded MSVCRTD.lib(chandler4gs.obj)

1>      Found __NULL_IMPORT_DESCRIPTOR

1>        Referenced in MSVCRTD.lib(MSVCR90D.dll)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found MSVCR90D_NULL_THUNK_DATA

1>        Referenced in MSVCRTD.lib(MSVCR90D.dll)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found __crt_debugger_hook

1>        Referenced in MSVCRTD.lib(gs_report.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found "int __cdecl _RTC_GetSrcLine(unsigned char *,wchar_t *,unsigned long,int *,wchar_t *,unsigned long)" (?_RTC_GetSrcLine@@YAHPAEPA_WKPAH1K@Z)

1>        Referenced in MSVCRTD.lib(_error_.obj)

1>        Loaded MSVCRTD.lib(_pdblkup_.obj)

1>      Found "void __cdecl terminate(void)" (?terminate@@YAXXZ)

1>        Referenced in MSVCRTD.lib(unhandld.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found __controlfp_s

1>        Referenced in MSVCRTD.lib(fp8.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found __invoke_watson

1>        Referenced in MSVCRTD.lib(fp8.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found __unlock

1>        Referenced in MSVCRTD.lib(atonexit.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found ___dllonexit

1>        Referenced in MSVCRTD.lib(atonexit.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found __lock

1>        Referenced in MSVCRTD.lib(atonexit.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found __imp___onexit

1>        Referenced in MSVCRTD.lib(atonexit.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found __imp___decode_pointer

1>        Referenced in MSVCRTD.lib(atonexit.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>      Found __except_handler4_common

1>        Referenced in MSVCRTD.lib(chandler4gs.obj)

1>        Loaded MSVCRTD.lib(MSVCR90D.dll)

1>    Searching C:\Program Files\Microsoft Visual Studio 9.0\VC\lib\OLDNAMES.lib:

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\kernel32.lib:

1>      Found __imp__InterlockedExchange@8

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__Sleep@4

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__InterlockedCompareExchange@12

1>        Referenced in MSVCRTD.lib(crtexe.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__TerminateProcess@8

1>        Referenced in MSVCRTD.lib(gs_report.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__GetCurrentProcess@0

1>        Referenced in MSVCRTD.lib(gs_report.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__UnhandledExceptionFilter@4

1>        Referenced in MSVCRTD.lib(gs_report.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__SetUnhandledExceptionFilter@4

1>        Referenced in MSVCRTD.lib(gs_report.obj)

1>        Referenced in MSVCRTD.lib(unhandld.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__IsDebuggerPresent@0

1>        Referenced in MSVCRTD.lib(gs_report.obj)

1>        Referenced in MSVCRTD.lib(_error_.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__RaiseException@16

1>        Referenced in MSVCRTD.lib(_error_.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__DebugBreak@0

1>        Referenced in MSVCRTD.lib(_error_.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__WideCharToMultiByte@32

1>        Referenced in MSVCRTD.lib(_error_.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__MultiByteToWideChar@24

1>        Referenced in MSVCRTD.lib(_error_.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__lstrlenA@4

1>        Referenced in MSVCRTD.lib(_error_.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__GetProcAddress@8

1>        Referenced in MSVCRTD.lib(_error_.obj)

1>        Referenced in MSVCRTD.lib(_pdblkup_.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__LoadLibraryA@4

1>        Referenced in MSVCRTD.lib(_error_.obj)

1>        Referenced in MSVCRTD.lib(_pdblkup_.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__QueryPerformanceCounter@4

1>        Referenced in MSVCRTD.lib(gs_support.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__GetTickCount@0

1>        Referenced in MSVCRTD.lib(gs_support.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__GetCurrentThreadId@0

1>        Referenced in MSVCRTD.lib(gs_support.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__GetCurrentProcessId@0

1>        Referenced in MSVCRTD.lib(gs_support.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__GetSystemTimeAsFileTime@4

1>        Referenced in MSVCRTD.lib(gs_support.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__HeapFree@12

1>        Referenced in MSVCRTD.lib(_pdblkup_.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__HeapAlloc@12

1>        Referenced in MSVCRTD.lib(_pdblkup_.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__GetProcessHeap@0

1>        Referenced in MSVCRTD.lib(_pdblkup_.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__GetModuleFileNameW@12

1>        Referenced in MSVCRTD.lib(_pdblkup_.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__VirtualQuery@12

1>        Referenced in MSVCRTD.lib(_pdblkup_.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __imp__FreeLibrary@4

1>        Referenced in MSVCRTD.lib(_pdblkup_.obj)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found __IMPORT_DESCRIPTOR_KERNEL32

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>      Found KERNEL32_NULL_THUNK_DATA

1>        Referenced in kernel32.lib(KERNEL32.dll)

1>        Loaded kernel32.lib(KERNEL32.dll)

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\user32.lib:

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\gdi32.lib:

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\winspool.lib:

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\comdlg32.lib:

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\advapi32.lib:

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\shell32.lib:

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\ole32.lib:

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\oleaut32.lib:

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\uuid.lib:

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbc32.lib:

1>    Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\odbccp32.lib:

1>    Searching C:\Program Files\Microsoft Visual Studio 9.0\VC\lib\MSVCRTD.lib:

1>    Searching C:\Program Files\Microsoft Visual Studio 9.0\VC\lib\OLDNAMES.lib:

1>Finished searching libraries

1>Finished pass 1

1>Generating non-SAFESEH image.

1>Invoking CVTRES.EXE:

1> /machine:x86

1> /verbose

1> /out:"C:\DOCUME~1\MIKERI~1\LOCALS~1\Temp\lnk1B6.tmp"

1> /readonly

1> ".\Debug\Winsock2sample.exe.embed.manifest.res"

1>Microsoft (R) Windows Resource To Object Converter Version 9.00.21022.08

1>Copyright (C) Microsoft Corporation.  All rights reserved.

1>adding resource. type:MANIFEST, name:1, language:0x0409, flags:0x30, size:2048

1>Winsock2samplesrc.obj : error LNK2019: unresolved external symbol __imp__WSACleanup@0 referenced in function _main

1>Winsock2samplesrc.obj : error LNK2019: unresolved external symbol __imp__WSAStartup@8 referenced in function _main

1>C:\networkdotnetproject\Winsock2sample\Debug\Winsock2sample.exe : fatal error LNK1120: 2 unresolved externals

1>Build log was saved at "file://c:\networkdotnetproject\Winsock2sample\Winsock2sample\Debug\BuildLog.htm"

1>Winsock2sample - 3 error(s), 0 warning(s)

========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

 

However, the Winsok2 library (WS2_32.lib) was not found and loaded! So we have to solve this problem.

The generated output such as where to find the header files, libraries, the path search order, where to put the intermediary files and many more are based on the settings set in the project’s Options page. The page can be invoked from the Tools > Options menu as shown below.

 

The Visual studio 2008/visual C++ .NET and winsock2 C code building (compile and link) issue and how-to documentation 25

 

Most of the time the default settings given (set during the installation) are appropriate for most of the common development tasks. So, 'most of the time', the option settings are not customized or refined by developer. However, for advanced developer with 'advanced application', this part should be their best 'assistant'. An example situation on refining the project’s option is when you want to include the third party libraries.

The following Figures show several Options settings for VC++ that will be enforced on and affect to all the C++ project. In this case, we do nothing in the Options page.

 

The Visual studio 2008/visual C++ .NET and winsock2 C code building (compile and link) issue and how-to documentation 26

 

The Visual studio 2008/visual C++ .NET and winsock2 C code building (compile and link) issue and how-to documentation 27

 

The Visual studio 2008/visual C++ .NET and winsock2 C code building (compile and link) issue and how-to documentation 28

 

Next, let have a peek on the Winsock2.h header file version. In our case, we see different Winsock2.h header file versions, installed and available from different paths based on the file Size and Date Modified properties as seen from the explorer. If you cannot find yours, that mean you are missing some modules during the installation and need to do the installation. In most cases, you need to install the Platform SDK module that will provide related specific resources such as libraries etc. for Windows platform application development. The file’s property page can also be accessed from the Properties context menu shown below.

 

The Visual studio 2008/visual C++ .NET and winsock2 C code building (compile and link) issue and how-to documentation 29

 

--------------------------------------------------------------

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

-------------------------------------------------------------

 

The Visual studio 2008/visual C++ .NET and winsock2 C code building (compile and link) issue and how-to documentation 30

 

From the following screenshot, the file size’s is 108 KB and modified date is 9/27/2007.

 

The Visual studio 2008/visual C++ .NET and winsock2 C code building (compile and link) issue and how-to documentation 31

 

From the following screenshot, the file size’s is 105 KB and modified date is 4/14/2005.

 

The Visual studio 2008/visual C++ .NET and winsock2 C code building (compile and link) issue and how-to documentation 32

 

From the following screenshot, the file size’s is 105 KB but the modified date is 3/3/2006.

 

The Visual studio 2008/visual C++ .NET and winsock2 C code building (compile and link) issue and how-to documentation 33

 

Then, from the Output messages, we know that the Winsok2.h header file used was the latest version for our VS 2008 as re-produced below.

C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winsock2.h

Next, let add the 'missing' WS2_32.lib to our project. We already knew that the W2_32.lib file is there and the latest version should be from the same path as the Winsock2.h file as can be seen from the search result and re-produced below.

C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib

In this case, we have confirmed that VS C++ 2008 already knew the path, but not the file, so we just tell 'her' which library file she need to find.

 

The Visual studio 2008/visual C++ .NET and winsock2 C code building (compile and link) issue and how-to documentation 34

 

Re-open the project’s property page.

 

The Visual studio 2008/visual C++ .NET and winsock2 C code building (compile and link) issue and how-to documentation 35

 

Expand the Configuration Properties folder > expand the Linker subfolder > select the Input node. For the Additional Dependencies setting, click the empty field on the right > click the ellipses.

 

The Visual studio 2008/visual C++ .NET and winsock2 C code building (compile and link) issue and how-to documentation 36

 

Type the library name, WS2_32.lib manually in the top empty text box of the Additional Dependencies page. Click the OK button to save the setting and close the Additional Dependencies page.

 

The Visual studio 2008/visual C++ .NET and winsock2 C code building (compile and link) issue and how-to documentation 37

 

Click OK button to save and close the project’s property page.

 

The Visual studio 2008/visual C++ .NET and winsock2 C code building (compile and link) issue and how-to documentation 38

 

Next, rebuild our solution.

 

The Visual studio 2008/visual C++ .NET and winsock2 C code building (compile and link) issue and how-to documentation 39

 

Notice that, from the verbose Output window, the WS2_32.lib was searched, found and included in the project.

 

The Visual studio 2008/visual C++ .NET and winsock2 C code building (compile and link) issue and how-to documentation 40

 

And we successfully, build (compile and link) our project this time.

 

The Visual studio 2008/visual C++ .NET and winsock2 C code building (compile and link) issue and how-to documentation 41

 

Next, the fun time. Run our project.

The Visual studio 2008/visual C++ .NET and winsock2 C code building (compile and link) issue and how-to documentation 42

 

The following shows the output.

 

The Visual studio 2008/visual C++ .NET and winsock2 C code building (compile and link) issue and how-to documentation 43

 

By following the same 'related previous steps' we try the second program example taken from http://www.tenouk.com/Winsock/Winsock2example1.html. The code re-produced below. In this code we have to replace the SOCKET m_socket; declaration at the top part of the source file. This indicate the restrictness settings for the project which can be customized through the project's property page and/or the Options page as shown previously.

#include <stdio.h>

#include <winsock2.h>

int main()

{

      WORD wVersionRequested;

      WSADATA wsaData;

      int wsaerr;

      //////////Create a socket////////////////////////

      //Create a SOCKET object called m_socket.

      SOCKET      m_socket;

     

      // Using MAKEWORD macro, Winsock version request 2.2

      wVersionRequested = MAKEWORD(2, 2);

      wsaerr = WSAStartup(wVersionRequested, &wsaData);

     

      if (wsaerr != 0)

      {

            /* Tell the user that we could not find a usable */

        /* WinSock DLL.*/

            printf("The Winsock dll not found!\n");

            return 0;

      }

      else

      {

            printf("The Winsock dll found!\n");

            printf("The status: %s.\n", wsaData.szSystemStatus);

      }

     

      /* Confirm that the WinSock DLL supports 2.2.        */

      /* Note that if the DLL supports versions greater    */

      /* than 2.2 in addition to 2.2, it will still return */

      /* 2.2 in wVersion since that is the version we      */

      /* requested.                                        */    

      if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2)

      {

            /* Tell the user that we could not find a usable */

            /* WinSock DLL.*/

            printf("The dll do not support the Winsock version %u.%u!\n", LOBYTE(wsaData.wVersion),HIBYTE(wsaData.wVersion));

            WSACleanup();

            return 0;

      }

      else

      {

            printf("The dll supports the Winsock version %u.%u!\n", LOBYTE(wsaData.wVersion),HIBYTE(wsaData.wVersion));

            printf("The highest version this dll can support: %u.%u\n", LOBYTE(wsaData.wHighVersion), HIBYTE(wsaData.wHighVersion));

      }

 

      // Call the socket function and return its value to the m_socket variable.

      // For this application, use the Internet address family, streaming sockets, and

      // the TCP/IP protocol.

      // using AF_INET family, TCP socket type and protocol of the AF_INET - IPv4

      m_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);

     

      // Check for errors to ensure that the socket is a valid socket.

      if (m_socket == INVALID_SOCKET)

      {

            printf("Error at socket(): %ld\n", WSAGetLastError());

            WSACleanup();

            return 0;

      }

      else

      {

            printf("socket() is OK!\n");

      }

      return 0;

}

 

The sample output:

The Visual studio 2008/visual C++ .NET and winsock2 C code building (compile and link) issue and how-to documentation 44

 

Well, it works! As mentioned before, we are not just trying to 'mess up' our VS C++ 2008 programming environment here, but more important thing is to learn and have some familiarities to the VS / VS C++ itself. In simple words, the same steps can be followed for other headers and/or libraries file inclusion to the project

One more thing that we want to mention if you build the program examples for Winsock at Tenouk.com is the Unicode issue. Unfortunately, we are not aware whether those codes are all based on the Unicode character set (optional support for older Visual IDE). However, based on the previous two program examples re-compilation, the Unicode is supported for the Winsok2 'resource' files. If you encounter this issue through the generated warning or error in the Output Window, you may want to try disable the Unicode support in the project's property page as shown below. The Unicode was set by default.

 

The Visual studio 2008/visual C++ .NET and winsock2 C code building (compile and link) issue and how-to documentation 45

 

 

 

 

 

 


| Winsock Home | Part 1 | Part 2 | Tenouk.com |