Code references something (such as a function, variable, or label) that the linker can't find in the libraries and object files.
Possible causes
What the code asks for doesn't exist (the symbol is spelled incorrectly or uses the wrong case, for example).
The code asks for the wrong thing (you are using mixed versions of the libraries, some from one version of the product, others from another version).
This error message is followed by fatal error LNK1120.
Specific causes
Coding Problems
If the LNK2001 diagnostic text reports that __check_commonlanguageruntime_version is an unresolved external symbol, see LNK2019 for information on how to resolve.
The definition of member template is outside the class. Visual C++ has a limitation in which member templates must be fully defined within the enclosing class. See KB article Q239436 for more information about LNK2001 and member templates.
Mismatched case in your code or module-definition (.def) file can cause LNK2001. For example, if you named a variable var1 in one C++ source file and tried to access it as VAR1 in another.
A project that uses function inlining yet defines the functions in a .cpp file rather than in the header file can cause LNK2001.
Calling a C function from a C++ program without using extern "C" (which causes the compiler to use the C naming convention) can cause LNK2001. Compiler options /Tp and /Tc cause the compiler to compile files as C or C++, respectively, regardless of the filename extension. These options can cause function names different from what you expect.
Attempting to reference functions or data that don't have external linkage can cause LNK2001. In C++, inline functions and const data have internal linkage unless explicitly specified as extern.
A missing function body or variable can cause LNK2001. With just a function prototype or extern declaration the compiler can continue without error, but the linker cannot resolve a call to an address or reference to a variable because there is no function code or variable space reserved.
Calling a function with parameter types that do not match those in the function declaration can cause LNK2001. Name decoration incorporates the parameters of a function into the final decorated function name.
Incorrectly included prototypes, which cause the compiler to expect a function body that is not provided can cause LNK2001. If you have both a class and non-class implementation of a function F, beware of C++ scope-resolution rules.
When using C++, including a function prototype in a class definition and failing to include the implementation of the function for that class can cause LNK2001.
Attempting to call a pure virtual function from the constructor or destructor of an abstract base class can cause LNK2001. A pure virtual function has no base class implementation.
Trying to access a static variable from outside the file in which it is declared can cause LNK2001. Functions declared with the static modifier by definition have file scope. Static variables have the same limitation.
Trying to use a variable declared within a function (a local variable) outside the scope of that function can cause LNK2001.
Trying to use a global constant in C++ in multiple files can cause LNK2001. In C++, unlike C, global constants have static linkage. To get around this limitation, you can include the const initializations in a header file and include that header in your .cpp files, or you can make the variable non-constant and use a constant reference to access it.
When building a Release version of an ATL project, indicates that CRT startup code is required. To fix, do one of the following,
Remove _ATL_MIN_CRT from the list of preprocessor defines to allow CRT startup code to be included. See General Configuration Settings Property Page for more information.
If possible, remove calls to CRT functions that require CRT startup code. Instead, use their Win32 equivalents. For example, use lstrcmp instead of strcmp. Known functions that require CRT startup code are some of the string and floating point functions.