Resolution of several link Link errors

Source: Internet
Author: User

Write a testProgramTo test the strcpy function manually written.CodeI did not expect a link error to occur during the migration:

Libcd. Lib (strcat. OBJ): Error lnk2005: _ strcpy already defined in cpp1.obj
Nafxcwd. Lib (thrdcore. OBJ): Error lnk2001: unresolved external symbol _ endthreadex
Nafxcwd. Lib (thrdcore. OBJ): Error lnk2001: unresolved external symbol _ beginthreadex
Debug/cpp1.exe: Fatal error lnk1120: 2 unresolved externals

 

Solution:

1. Change the strcpy name in the program. Error lnk2005 indicates that strcpy has been defined, which reminds me that strcpy is a library function. In the program, change strcpy to strcpy, and then run it without error lnk2005.

2. In the "project"> "Settings"> "general"> "Microsoft basics" drop-down box of VC, select "use MFC as the shared DLL" and run the program. The reason is: the MFC macro is used in the test program, but afx. H is added without setting the library file.

 

 

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.