Getting Linking error in Visual C++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bishnu12
    New Member
    • Jan 2007
    • 5

    Getting Linking error in Visual C++

    Hi all,

    I am trying to compile a C++ code which i have written for creating a socket and doing simple linking with a server in VC++. The code compiles fine. But while building the code(using the Build command) it throws the following error.

    --------------------Configuration: domain - Win32 Debug--------------------
    Linking...
    sockets.obj : error LNK2001: unresolved external symbol _getaddrinfo@16
    Debug/domain.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    domain.exe - 2 error(s), 0 warning(s)

    Anybody has any knowledge about which .lib file to be added to remove the error or any other suggestion to remove the error......plea se share it with me.

    Thanks,
    Bishnu
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    I do not see any such function as getaddrinfo in my Windows Sockets implementation.

    Either it is a function you have forgotten to implement or you meant a different function.

    Comment

    • Motoma
      Recognized Expert Specialist
      • Jan 2007
      • 3236

      #3
      Make sure you are linking against Ws2_32.dll

      Comment

      • bishnu12
        New Member
        • Jan 2007
        • 5

        #4
        Thank you very much for your response. I got it fixed. You have to include Wspiapi.h header file. It solves the problem as it has these two functions implemented.

        Comment

        Working...