newbe - VC++ 6 Linker error - Programmer

This is a discussion on newbe - VC++ 6 Linker error - Programmer ; Hi I've got a little dialog-based program. Now I've added 2 new files to the project: FastSmtp.cpp and FastSmtp.h (form codeproject.com). But if I compile now (not even using this class already) I get 12 Linker errors: FastSmtp.obj : error ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: newbe - VC++ 6 Linker error

  1. newbe - VC++ 6 Linker error

    Hi

    I've got a little dialog-based program. Now I've added 2 new files to
    the project: FastSmtp.cpp and FastSmtp.h (form codeproject.com). But
    if I compile now (not even using this class already) I get 12 Linker
    errors:

    FastSmtp.obj : error LNK2001: Unresolved extern symbol
    __imp__WSACleanup@0
    __imp__WSAGetLastError@0
    __imp__WSAStartup@8
    __imp__recv@16
    __imp__send@16
    __imp__connect@12
    __imp__htons@4
    __imp__getservbyname@8
    __imp__socket@12
    __imp__gethostbyname@4
    __imp__inet_ntoa@4
    __imp__gethostname@8

    Why the heck is this and how can it be solved?

    cheers

  2. Re: newbe - VC++ 6 Linker error

    "Lorenz Blum" wrote:

    > FastSmtp.obj : error LNK2001: Unresolved extern symbol
    > __imp__WSACleanup@0
    > __imp__WSAGetLastError@0
    > __imp__WSAStartup@8


    Add "ws2_32.lib" to the linker arguments. Add it after
    any non-OS (user32, kernel32 etc.) libraries is a good practice
    since several linkers are single-pass only.

    --
    --gv

    GNU GPL: Free as in herpes.

  3. Re: newbe - VC++ 6 Linker error

    "Gisle Vanem" wrote in message news:<4082d59a$1@news.broadpark.no>...

    > Add "ws2_32.lib" to the linker arguments. Add it after
    > any non-OS (user32, kernel32 etc.) libraries is a good practice
    > since several linkers are single-pass only.


    Thanks, I'll try this. But for the future: Why do you know that, how
    can I learn this by myself (tutorial/book) and why does VC not make it
    itself?

    greetings

  4. Re: newbe - VC++ 6 Linker error

    How to know which .LIB should be linked ? I have set VC and MFC
    LIB and INCLUDE path in developer Studio.

    I got linking error:

    nafxcw.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthread
    ex
    nafxcw.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthre
    adex

    *.exe : fatal error LNK1120: 2 unresolved externals

    Repl to "Ji.Zhang @ NRC.CA" [no spaces in the address]

    thanks.
    ------------------------------------------------------------

    "> "Lorenz Blum" wrote:
    >
    > > FastSmtp.obj : error LNK2001: Unresolved extern symbol
    > > __imp__WSACleanup@0
    > > __imp__WSAGetLastError@0
    > > __imp__WSAStartup@8

    >
    > Add "ws2_32.lib" to the linker arguments. Add it after
    > any non-OS (user32, kernel32 etc.) libraries is a good practice
    > since several linkers are single-pass only.


  5. Re: newbe - VC++ 6 Linker error

    Ji Zhang wrote:
    > How to know which .LIB should be linked ? I have set VC and MFC
    > LIB and INCLUDE path in developer Studio.
    >
    > I got linking error:
    >
    > nafxcw.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthread
    > ex
    > nafxcw.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthre
    > adex
    >
    > *.exe : fatal error LNK1120: 2 unresolved externals
    >


    This error means that you are using MFC but when you first set up the
    project you did not select one of the MFC project types. MFC requires
    that you use a multithreaded version of the runtime library.

    See Project Settings, C/C++ page, set category to 'Code Generation.'
    Change 'Use runtime library' to one of the multithreaded choices. This
    has to be done twice: In your debug build select a debug multithreded
    choice, and in your release build select a multithreaded choice.

    --
    Scott McPhillips [VC++ MVP]


+ Reply to Thread