[Qt] error: LNK1107: Invalid or corrupt file: cannot read at 0x310

When compiling a Qt program to use a dynamic library, an error is reported

error: LNK1107: invalid or corrupt file: cannot read at 0x310

reason

When linking, use the dll, not the lib.
lib is needed at compile time and dll is needed at runtime.

Dynamic library and static library under windows

Dynamic library: When generating a dynamic library, in addition to generating a dll, there is a corresponding lib. Here, the lib is not a static library but an import library of the dynamic link library at compile time. So dll and lib are needed at compile time; dll is needed at runtime

Static library: There is only one lib library, which is required at compile time, and the lib is compiled into the program, so at runtime, it is no longer needed

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325523056&siteId=291194637