Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Linking Errors

DelphiDelphi Posts: 42Member
Hello.

I've been trying to get some source code to compile from a project that I picked up. This code wasn't originally mine to work with, and it's written in C, not C++.

As best as I can tell, this was originally compiled using Visual Studio 6.0, and I'm using Visual Studio 2005. After sorting some 300+ compile time errors, I'm left with these linking errors:

[code]tcp.obj : error LNK2019: unresolved external symbol _send@16 referenced in function _send2
tcp.obj : error LNK2019: unresolved external symbol _WSAAsyncSelect@16 referenced in function _init_aol
tcp.obj : error LNK2019: unresolved external symbol _wmhandler_set referenced in function _init_aol
tcp.obj : error LNK2019: unresolved external symbol _listen@8 referenced in function _init_aol
tcp.obj : error LNK2019: unresolved external symbol _bind@12 referenced in function _init_aol
tcp.obj : error LNK2019: unresolved external symbol _htons@4 referenced in function _init_aol
tcp.obj : error LNK2019: unresolved external symbol _socket@12 referenced in function _init_aol
tcp.obj : error LNK2019: unresolved external symbol _winio_current referenced in function _init_aol
tcp.obj : error LNK2019: unresolved external symbol _ntohs@4 referenced in function _init_tcp
tcp.obj : error LNK2019: unresolved external symbol _WSAStartup@8 referenced in function _init_tcp
tcp.obj : error LNK2019: unresolved external symbol _recv@16 referenced in function _gotdata
tcp.obj : error LNK2019: unresolved external symbol _closesocket@4 referenced in function _myfunc
tcp.obj : error LNK2019: unresolved external symbol _accept@12 referenced in function _myfunc[/code]

It appears to me that these errors have something to do with winsock, but I've never really done any network programming. I'm just 'playing around' with this code to see if I can get it compiled, just look through it to see things, that sort of thing.


Comments

  • stoberstober Posts: 9,765Member ✭✭✭
    [b][red]This message was edited by stober at 2006-2-5 21:0:52[/red][/b][hr]
    add ws2_32.lib to the project


  • DelphiDelphi Posts: 42Member
    Thank you for the prompt reply. Adding ws2_32.lib to the project indeed fixed my linking errors.

    The next problem I run into is a small window popping up everytime I try and run the compiled program:

    Window Title:

    Microsoft Visual C++ Debug Library

    Window Text:

    Debug Assertion Failed!

    Program: ...
    File: close.c
    Line: 47

    Expression: (fh >= 0 && (unsigned)fh < (unsigned)_nhandle)

    For information on how your program can cause assertion
    failure, see the Visual C++ documentation on asserts.

    (Press Retry to debug the application)

    Buttons:

    Abort, Retry, Ignore

    There is no close.c in the program, and a quick search through the files returned no match on the expression listed as the culprit. Is this a program with some header file that I am linking to, and if so, how can I fix this?
Sign In or Register to comment.