fatal error LNK2019[UNK]fatalerror LNK1120

The reason for the error is as follows:

① You use other people’s libraries, such as opencv library, OpenGL library and other third-party libraries. The common situation is that you only include the header file, but there is no import file

② You don’t use other people’s libraries. Some of Microsoft’s own libraries may also have such problems. At this time, the common situation is that the header file of the failed function is in the included directory of the project property, but the corresponding library file is not in the default library directory of the project property. For example, create view glcontext (struct HDC) in FAQ style__ *) function is such a case. This function is defined in the header file wingdi. H. This header file is in the default included directory in the project properties, but the corresponding library file opengl32. Lib is not in the library directory

③ You use your own library file. I haven’t tried this situation. I’ve seen some comments on the Internet

Fatal error lnk1120 cause:

① . contains only the header file, only the declaration of this function, but not the implementation of this function (the implementation is generally placed in the cpp file). So it can only be compiled, and the connection is not successful.

② Another reason is that the declaration and implementation of the function are put in the header file. Generally, the declaration should be put in the header file and the implementation in the cpp file. In this way, each file that contains the header file will have an implementation of the function. When connecting, the connector does not know which implementation to connect, so an error is reported.

 

 

Read More: