C++ / Documentation search
Find the error. Find the next step.
Search by diagnostic code, copied message, or symptom. Filter by content and project system.
47 results
Browse documentation →LNK1112: Old object files remain in a shared folder.
When Win32 and x64 share the intermediate directory, objects of one platform are linked into the other: include $(Platform) in Intermediate Directory and rebuild.
LNK1112: The target machine is set by hand.
Set Linker > Advanced > Target Machine back to Not Set , or remove /MACHINE from the additional options.
LNK1181: Its folder is not in the library directories.
Add it to Linker > General > Additional Library Directories for every configuration and platform.
LNK1181: The library is built by another project that has not run yet.
Add a project reference to that project, so that Visual Studio builds it first and links it.
LNK1181: The library name is wrong.
Check the name in Linker > Input > Additional Dependencies against the file on disk, for example zlibd.lib in Debug.
LNK1181: The name contains a space.
An unquoted name with spaces in the additional options is read as two files: quote it.
LNK2001: A global variable is only declared extern .
Define it, without extern , in exactly one .cpp file.
LNK2001: A library or a source file is missing.
The causes of LNK2019 apply too: check that the defining file is in the project and that its library is linked for this configuration and platform.
LNK2001: A static data member is declared but not defined.
Define it once in a .cpp file ( int Counter::count = 0; ), or declare it inline static in C++17.
LNK2001: A virtual function has no definition.
Provide definitions for the declared non-pure virtual functions, including a declared virtual destructor. A pure virtual destructor also needs a definition when derived objects are destroyed.
LNK2019: main or WinMain is missing.
An unresolved main referenced in invoke_main means that Linker > System > SubSystem does not match the entry point: Console expects main , Windows expects WinMain .
LNK2019: A template or an inline function is defined in a .cpp file.
Move its definition to the header: it must be visible wherever it is used.
LNK2019: C code is called from C++ without extern "C" .
Wrap the C declarations in extern "C" { } in the header, so that C++ looks for the undecorated name.
LNK2019: The .cpp file that defines it is not part of the project.
Add the file to the project in Solution Explorer: a file on disk that is not in the project is never compiled.
LNK2019: The declaration and the definition do not match.
Compare the signature: a missing const , a different parameter type, another namespace, or a member function defined without its Class:: prefix declares a different symbol.
LNK2019: The function is declared but never defined.
Write its body, or remove the call. A declaration in a header is only a promise that a definition exists somewhere.
LNK2019: The library that defines it is not linked.
Add the .lib to Linker > Input > Additional Dependencies and its folder to Linker > General > Additional Library Directories , for every configuration and platform. For a library built in the same solution, add a project reference instead.
LNK2019: The library was built for another platform.
Link the x64 library in x64 builds and the x86 library in Win32 builds.
LNK2038: A Release library is linked into a Debug build.
A mismatch on _ITERATOR_DEBUG_LEVEL (0 against 2) means that Debug and Release code are mixed: link the Debug version of the library in Debug builds.
LNK2038: A prebuilt third-party library uses another runtime.
Use the variant built for your runtime, or rebuild it with your settings, for example with the matching vcpkg triplet.