Error map

LNK2019 MSVC: error LNK2019: unresolved external symbol "void __cdecl foo(void)" referenced in function main

C/C++ · layer 4, Application & API

Open the full error page →

Centre: this error. First ring: errors it is linked with (9). Outer ring: what those are linked with. Colours show the layer of a request each error belongs to. Click any dot to re-centre the map on it; hover to follow its connections. The centre dot opens the error page.

LNK2019 — MSVC: error LNK2019: unresolved external symbol "void __cdecl foo(void)" referenced in function main (C/C++)LNK2019LNK1104 — MSVC: fatal error LNK1104: cannot open file 'foo.lib' (or 'app.exe' while it is running) (C/C++)LNK1104C1083 — MSVC: fatal error C1083: Cannot open include file: 'foo.h': No such file or directory (C/C++)C1083LNK2038 — MSVC: error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' (C/C++)LNK2038LNK1112 — MSVC: fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64' (C/C++)LNK1112recompile with -fPIC — relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC (C/C++)recompile with -fPICfile in wrong format — ld: file in wrong format / skipping incompatible libfoo.so when searching (C/C++)file in wrong formatLNK2001 — MSVC: error LNK2001: unresolved external symbol / LNK1120: unresolved externals (C/C++)LNK2001LNK2005 — MSVC: error LNK2005: already defined in main.obj / LNK1169: one or more multiply defined symbols found (C/C++)LNK2005C1010 — MSVC: fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "pch.h"' (C/C++)C1010undefined reference to — C/C++: undefined reference to `function' — collect2: error: ld returned 1 exit status (C/C++)undefined reference…multiple definition of — C/C++: multiple definition of `x'; first defined here — ld returned 1 exit status (C/C++)multiple definition…undefined reference to vtable — C++: undefined reference to `vtable for X' — virtual function not defined (C/C++)undefined reference…fatal error: No such file or directory — C/C++: fatal error: foo.h: No such file or directory — #include not found (C/C++)fatal error: No suc…C4996 — MSVC: error C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead (C/C++)C4996C2065 — MSVC: error C2065: 'x': undeclared identifier (C/C++)C2065D8016 — MSVC: command line error D8016: '/RTC1' and '/O2' command-line options are incompatible (C/C++)D8016cannot find -l — /usr/bin/ld: cannot find -lssl: No such file or directory (C/C++)cannot find -lundefined reference to sqrt — undefined reference to `sqrt' / `pow' / `sin' — missing -lm (C/C++)undefined reference…undefined reference to dlopen — undefined reference to `dlopen' / `dlsym' — missing -ldl (C/C++)undefined reference…undefined reference to pthread_create — C/C++: undefined reference to `pthread_create' — missing -pthread (also `dlopen`, `clock_gettime`) (C/C++)undefined reference…ld: library not found for -lssl — macOS: ld: library 'ssl' not found / ld: library not found for -lssl (clang: error: linker command failed) (macOS)ld: library not fou…undefined reference to clock_gettime — undefined reference to `clock_gettime' / `shm_open' / `timer_create' — missing -lrt (C/C++)undefined reference…undefined reference to std::filesystem — undefined reference to `std::filesystem::...' — link stdc++fs (C/C++)undefined reference…undefined reference to typeinfo — undefined reference to `typeinfo for X' (C/C++)undefined reference…undefined reference to curl_easy_init — undefined reference to `curl_easy_init' / `SSL_new' / `EVP_...' (library not linked) (C/C++)undefined reference…C2039 — MSVC: error C2039: 'x': is not a member of 'Y' (C/C++)C2039C2664 — MSVC: error C2664: cannot convert argument 1 from 'X' to 'Y' (C/C++)C2664C2512 — MSVC: error C2512: 'X': no appropriate default constructor available (C/C++)C2512

Directly related (9)

LNK1104C/C++

MSVC: fatal error LNK1104: cannot open file 'foo.lib' (or 'app.exe' while it is running)

The Visual C++ linker could not open an input library or the output file — the path is wrong, the library is missing, or the .exe…

C1083C/C++

MSVC: fatal error C1083: Cannot open include file: 'foo.h': No such file or directory

The compiler cannot find a header.

LNK2038C/C++

MSVC: error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease'

Objects or libraries were built with different C runtime settings.

LNK1112C/C++

MSVC: fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64'

Mixing 32-bit and 64-bit objects or libraries.

recompile with -fPICC/C++

relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC

Code that was not compiled as position-independent was linked into a shared library.

file in wrong formatC/C++

ld: file in wrong format / skipping incompatible libfoo.so when searching

The linker found a library built for a different architecture or format (32-bit vs 64-bit, x86 vs ARM, ELF vs Mach-O).

LNK2001C/C++

MSVC: error LNK2001: unresolved external symbol / LNK1120: unresolved externals

Same family as LNK2019 for data or non-function symbols; LNK1120 counts them.

LNK2005C/C++

MSVC: error LNK2005: already defined in main.obj / LNK1169: one or more multiply defined symbols found

The same symbol is defined in more than one translation unit.

C1010C/C++

MSVC: fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "pch.h"'

A source file does not start with the precompiled header include.

Two steps away (19)

undefined reference toC/C++

C/C++: undefined reference to `function' — collect2: error: ld returned 1 exit status

The linker can’t find the definition of a function or variable that was declared and used.

multiple definition ofC/C++

C/C++: multiple definition of `x'; first defined here — ld returned 1 exit status

The linker found the same function or global variable defined in two object files — usually something defined in a header.

undefined reference to vtableC/C++

C++: undefined reference to `vtable for X' — virtual function not defined

The linker cannot find the class's virtual table, which means at least one virtual member function was declared but never defined…

fatal error: No such file or directoryC/C++

C/C++: fatal error: foo.h: No such file or directory — #include not found

The preprocessor cannot find a header named in `#include`: wrong path, missing include directory (-I), or the library is not inst…

C4996C/C++

MSVC: error C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead

Visual C++ treats classic C library functions such as `strcpy`, `sprintf`, `fopen` and `scanf` as deprecated or unsafe and, with…

C2065C/C++

MSVC: error C2065: 'x': undeclared identifier

Visual C++ met a name it has not seen declared — a typo, a missing header or namespace, or use outside its scope.

D8016C/C++

MSVC: command line error D8016: '/RTC1' and '/O2' command-line options are incompatible

Debug runtime checks cannot be combined with optimisation.

cannot find -lC/C++

/usr/bin/ld: cannot find -lssl: No such file or directory

The linker was told to link `-lfoo` but cannot find libfoo.so or libfoo.a in any search path.

undefined reference to sqrtC/C++

undefined reference to `sqrt' / `pow' / `sin' — missing -lm

The math library is not linked, so libm functions are unresolved.

undefined reference to dlopenC/C++

undefined reference to `dlopen' / `dlsym' — missing -ldl

The dynamic-loading library is not linked (older glibc).

undefined reference to pthread_createC/C++

C/C++: undefined reference to `pthread_create' — missing -pthread (also `dlopen`, `clock_gettime`)

Your program uses threads (or another system library) but the linker was not told to link it.

ld: library not found for -lsslmacOS

macOS: ld: library 'ssl' not found / ld: library not found for -lssl (clang: error: linker command failed)

The linker can't find OpenSSL (or another library) because Homebrew libraries aren't on its search path.

undefined reference to clock_gettimeC/C++

undefined reference to `clock_gettime' / `shm_open' / `timer_create' — missing -lrt

POSIX realtime functions live in librt on older glibc.

undefined reference to std::filesystemC/C++

undefined reference to `std::filesystem::...' — link stdc++fs

GCC 8 and older need `-lstdc++fs` for ``.

undefined reference to typeinfoC/C++

undefined reference to `typeinfo for X'

A class with virtual functions has no key function defined, or RTTI settings differ.

undefined reference to curl_easy_initC/C++

undefined reference to `curl_easy_init' / `SSL_new' / `EVP_...' (library not linked)

A third-party library header was included, but the library itself was never linked.

C2039C/C++

MSVC: error C2039: 'x': is not a member of 'Y'

The name is not declared in that class or namespace.

C2664C/C++

MSVC: error C2664: cannot convert argument 1 from 'X' to 'Y'

A function call passes an argument of the wrong type.

C2512C/C++

MSVC: error C2512: 'X': no appropriate default constructor available

A default-constructed object requires a default constructor that does not exist.