About the solution to the LNK 2005 encountered

Source: Internet
Author: User

In order to test C + + middleware, need to do some public test functions, before testing the C # interface to write a number of common test class, this thought transplanted over the sorta, the results of the middle or some of the problems, debugging for a while, the edge of the internet to solve the problem, the end of the grammar The result is a link error after compilation:

Error LNK2005: "Void __cdecl operator delete (void *)" (?? 3@YAXPAX@X) already defined in Libcpmt.lib (delop.obj)

Long time no VC6, vaguely remember that this error may be because the header file path is not set up, so began my error screening project:

1, first check the Project->settings->c/c++,preprocessor additional Include directories, the result of the specified include path is set.

2, will not be repeatedly linked to the header file. The *.h and *.cpp #include between the test classes are then sorted out sequentially, and the duplicate definition include is removed and consolidated. Clean and then build again, errors still exist.

3, continue to check, the Internet has said, may be some of the basis of the library header file order errors, which mentioned a library name Libcpmt.lib, my heart Suddenly a bright "1." As with the library in the link error, there is a chance. "Modified by someone else's method, 2 static libraries were added to the front of the project->settings->c/c++,general object/library modules: Nafxcw.lib libcpmt.lib. The internet also mentions the need in the input of the Ignore libraries first ignore these 2 libraries, I did not make this change. Compiled, passed out.

Now code compilation has no problem, but the estimated implementation will also appear a lot of conditions, today only completed a Long March road in a step, still need to continue efforts ah.

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.