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.