Having trouble with Linker Error 2001

Discussion in 'C' started by BenShums, Jan 1, 2008.

  1. BenShums

    BenShums New Member

    Joined:
    Jan 1, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Hi,
    I'm having trouble getting this linker bug to go away.
    I have 2 files: Socket.cpp and Socket.h. I know that these files are legitamite because my professor gave them to me during last semester.

    When I remove socket.cpp, everything compiles just fine. But with Socket.cpp, I get these errors.

    __________________________________________________ _____________
    Error 16 error LNK2001: unresolved external symbol ___WSAFDIsSet@8 socket.obj
    Error 11 error LNK2001: unresolved external symbol __imp__accept@12 socket.obj
    Error 9 error LNK2001: unresolved external symbol __imp__bind@12 socket.obj
    Error 4 error LNK2001: unresolved external symbol __imp__closesocket@4 socket.obj
    Error 14 error LNK2001: unresolved external symbol __imp__connect@12 socket.obj
    Error 13 error LNK2001: unresolved external symbol __imp__gethostbyname@4 socket.obj
    Error 8 error LNK2001: unresolved external symbol __imp__htons@4 socket.obj
    Error 5 error LNK2001: unresolved external symbol __imp__ioctlsocket@12 socket.obj
    Error 10 error LNK2001: unresolved external symbol __imp__listen@8 socket.obj
    Error 6 error LNK2001: unresolved external symbol __imp__recv@16 socket.obj
    Error 15 error LNK2001: unresolved external symbol __imp__select@20 socket.obj
    Error 7 error LNK2001: unresolved external symbol __imp__send@16 socket.obj
    Error 3 error LNK2001: unresolved external symbol __imp__socket@12 socket.obj
    Error 2 error LNK2001: unresolved external symbol __imp__WSACleanup@0 socket.obj
    Error 12 error LNK2001: unresolved external symbol __imp__WSAGetLastError@0 socket.obj
    Error 1 error LNK2001: unresolved external symbol __imp__WSAStartup@8 socket.obj
    Error 17 fatal error LNK1120: 16 unresolved externals C:\Users\Ben\Desktop\Documents\Visual Studio 2008\Projects\ConnectionDLL2\Release\ConnectionDLL 2.dll
    -----------------------------------------------------------------------------------------------------

    Socket.h includes
    #include <WinSocket.h>
    #include <string>
    #include "ConnectionDLL2.h"


    Socket.cpp includes...
    #include "stdafx.h"
    --> Which includes
    #pragma once
    #include "targetver.h"
    #include <stdio.h>
    #include <windows.h>
    #include <iostream>
    #include <string>
    #include <list>
    #include <map>
    #include <algorithm>
    #include <queue>
    #include <process.h>
    #include <strstream>
    using namespace std;
    #include "Socket.h"


    Also note that I'm using Visual C++ 2008 (which is very similar to VC2005)

    Thanks

    ~Ben S.
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    You don't have the necessary libs included for compiling the file socket.cpp
     
  3. BenShums

    BenShums New Member

    Joined:
    Jan 1, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    thaaaaaaaaaaaaaaaaaaaaank you.
    Thank you thank you thank you thank. And thanks. I've been working on this stupid problem for hours. Thank you.
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice