VC compilation error: msvcrtd. Lib (ti_inst.obj): Error lnk2005: "Private: _ thiscall type_info: t... already defined in libcmtd. Lib (typinfo. OBJ)

Source: Internet
Author: User

1> msvcrtd. Lib (ti_inst.obj): Error lnk2005: "Private: _ thiscall type_info: type_info (class type_info const &)"( [Email protected] @ [Email protected] @ Z) has been defined in libcmtd. Lib (typinfo. OBJ)
1> msvcrtd. Lib (ti_inst.obj): Error lnk2005: "Private: Class type_info & _ thiscall type_info: Operator = (class type_info const &)"( [Email protected] @[Email protected] @ Z) has been defined in libcmtd. Lib (typinfo. OBJ)
1> msvcrtd. Lib (msvcr80d. dll): Error lnk2005: _ crtdbgreportw has been defined in libcmtd. Lib (dbgrptw. OBJ)
1> msvcrtd. Lib (msvcr80d. dll): Error lnk2005: _ wcslen has been defined in libcmtd. Lib (wcslen. OBJ)
1> msvcrtd. Lib (msvcr80d. dll): Error lnk2005: _ vsprintf_s has been defined in libcmtd. Lib (vsnprnc. OBJ)
1> msvcrtd. Lib (msvcr80d. dll): Error lnk2005: _ sprintf_s has been defined in libcmtd. Lib (sprintf. OBJ)
1> msvcrtd. Lib (msvcr80d. dll): Error lnk2005: _ vswprintf_s has been defined in libcmtd. Lib (vswprnc. OBJ)
1> msvcrtd. Lib (msvcr80d. dll): Error lnk2005: _ swprintf_s has been defined in libcmtd. Lib (swprintf. OBJ)
1> libcmtd. Lib (crt0init. OBJ): Warning lnk4098: the default library "msvcrtd. lib" conflicts with other libraries. Use/nodefaultlib: Library

Reference: http://blog.csdn.net/wuxch_hz/archive/2010/02/24/5321586.aspx

Http://topic.csdn.net/t/20030507/17/1751913.html

 

Solution: Ignore conflicting libraries. For example, msvcrtd. Lib is ignored here because it is linked in my own Lib, And the compiled EXE should use the libcmtd. Lib library.

Alternatively, use the DLL configuration in the EXE, that is, add macro definition _ afxdll and debug the DLL configuration using/MDD multithreading.

This is mainly because of library conflicts during running.

 

Note:

The above method still does not work! Other problems may occur.

The following are the latest solutions I have found:

First, use/MTD or/mt to compile all lib files. Use/MTD in debug mode and/MT in release mode.

Then, use/MTD or/MT compilation in your own program. In this way, there will be no problems.

Three methods to compile the Linked Library:

(1) connect to the Windows library. For applications compiled by Win32 APIs, the above method may bring new problems. You can ignore the libcmt. Lib library. If there are other problems, ignore the corresponding library.

(2) MFC static link. The above method is for this connection method, so there is no problem.

(3) MFC dynamic link. I have not tried it. It should be similar to (1.

 

Finally, if not, add the/Force: Multiple compilation parameter directly. The reason why I didn't use it this time is also for the sake of rigor.

 

By: zhanyonhu

From: http://zhanyonhu.blog.163.com/blog/static/1618604420102292542353/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.