Visual C Concept: Generate a C / C program
Linkr tool error LNK2005 has defined symbols in the object
A given Symbol displayed in a modified form is defined multiple times.
possible reason
Inadvertently link with single-line libraries and multi-thread library. Make sure the application project file includes only the appropriate library, and any third party library has created a single-thread or multi-threaded version. Mix static libraries and dynamic libraries when using / CLR. This symbol is a package function (created by using / gy), which is included in multiple files, but has changed between each compilation. Re-build all files that contain symbol. This symbol is defined in two member objects in different libraries in different forms, and these two member objects are used. A absolute symbol is defined twice, and each defined value is different. The header file declares and defines a variable. Possible solutions are: Declared variables in .h: Extern Bool MyBool; and then assign it in .c or .cpp file: BOOL MyBool = false ;. State the variable as static. State the variable as Selectany. When UUID.LIB is used with other .lib files (such as OLIDB.LIB and ADSIID.LIB) that define the GUID. For example: OLEDB.LIB (OLEDB_I.Obj): Error LNK2005: _iid_itransactionObjectalReady Defined In Uuid.lib (Go7.Obj) To fix, add / force: multiple to the linker command line option, and make sure uuid.lib is a reference The first library.
For more information, see Knowledge Base Articles:
Q148652, PRB: LNK2005 ERRORS WHEN LINK C RUN-TIME LIBRARIES ARE LINKED BEFORE MFC Libraries. Q140440, FIX: Global Overloaded delete operator causes lnk2005. Q184235, PRB: lnk2005 errors on new and delete when defining _tl_min_crt. This error is followed by a fatal error LNK1169.