C++ / Documentation search
Find the error. Find the next step.
Search by diagnostic code, copied message, or symptom. Filter by content and project system.
205 results
Browse documentation →LNK1104: The file name contains the wrong configuration or platform.
Check macros such as $(Configuration) and $(Platform) in the dependency name and in the library directories.
LNK1104: The library folder is not in the search path.
Add it to Linker > General > Additional Library Directories for the configuration and platform you build. Paths set only for Debug or only for Win32 are a common trap.
LNK1104: The library is built by another project that has not been built yet.
Add a project reference, or a build dependency in Project Dependencies , so that the library is built first.
LNK1112: A library was built for the other platform.
Link the x64 build of the library in x64 configurations and the x86 one in Win32, with platform-specific paths in Linker > General > Additional Library Directories , such as lib\$(PlatformTarget) .
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.
LNK1120: LNK2001 errors precede it.
Each one names an unresolved symbol, which may be a function, static member, or variable. See how to fix LNK2001 .
LNK1120: LNK2019 errors precede it.
Each one names an unresolved symbol and the function that references it. See how to fix LNK2019 .
LNK1120: The Error List shows only LNK1120.
Open the Build output: it lists every unresolved symbol, with the object file that uses it.
LNK1168: Another tool holds the file.
An antivirus scanning the new file, a profiler, or a process that loaded the DLL can lock it for a moment: build again, or close that tool.
LNK1168: The file is read-only.
Clear the read-only attribute of the output file or folder.
LNK1168: The program is still running.
Close it, or stop debugging. A console program that waits for a key, or a process that hangs after its window closed, keeps the file locked: end it in Task Manager.
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.