Http://www.cnblogs.com/hiloves/p/4678848.html
- The essence of this error is that the linker cannot find the function definition in the compiled obj, lib, or DLL file.
- The problem I encountered was mixed C and C + +.
You write your own function declaration of the header file also wrote the function definition of the CPP file also joined the project and you are sure that the function body is definitely in this library file, but still appear LNK2019 error. Possible reasons:C and C + + language mixed, because C + + support function overloading so the C + + compiler generated by the library file function name will be unrecognizable, such as the C compiler will generate _readregmark this function name, and C + + compiler generated "void __ Cdecl Readregmark (char *) "([email protected]@[email protected]) such a function name. When your function is written in C, the VS compiler will be compiled according to the C language rules, but the linker does not know that it is silly to use the C + + rules of the function name to find the results can not be found, and you are sure TM is not in this library you a blind. Workaround: Add the header file in the C language
#ifdef __cplusplus extern " C " {#endifvoid readregmark (char *regmark); // write the function declaration here #ifdef __cplusplus} #endif
Give the linker a hint that this function is C language, do not look for the wrong TM.
Analysis of "error LNK2019: unresolved external symbols"