LNK2020/LNK1120

NEW TO C++ AND CANNOT GET THRU FIRST PROGRAM-"HELLO WORLD" BECAUSE OF LINKER ERROR MESSAGES AS FOLLOWS:

HELLO1 error LNK2020: unresolved token (0A000015) _CxxThrowException
HELLO1 error LNK2020: unresolved token (0A000017) delete
HELLO1 error LNK2020: unresolved token (0A00001A) strlen
HELLO1 error LNK2020: unresolved token (0A00001B) free
HELLO1 error LNK2020: unresolved token (0A00001D) memmove
HELLO1 error LNK2020: unresolved token (0A000028) memcpy
HELLO1 fatal error LNK1120: 6 unresolved externals

THERE WERE NO COMPILER ERRORS.

PROGRAM CODE AS FOLLOWS:

#include <iostream>

using namespace std;

int main()

{

cout << "Hello, World!" <<endl;

return 0;

}



THANKS

JIM


Answer this question

LNK2020/LNK1120

  • Thomast22

    Jim: from the look of the error messages above you are missing one or more libraries from link step. At the link step you need to include msvcr80.lib and, possibly, msvcp80.dll.

  • MarioFromBelgium

    It is msvcrt.lib if you compile with /MD or libcmt.lib if you compile with /MT, and in Debug mode msvcrtd.lib if you compile with /MDd or libcmtd.lib if you compile with /MTd. More information can be found on this page, http://msdn2.microsoft.com/library/2kzt1wy3(en-us,vs.80).aspx.  Most likely linker does not try resolving these symbols in CRT DLL because /nodefaultlib switch is passed to the linker. Try to find it and remove it.

    Nikola
    VC++


  • LNK2020/LNK1120