Problems with switching to vc6

Source: Internet
Author: User
Add a new article: About C pointer... author: longlongago blog address: http://blog.csdn.net/longlongago2000 today with vc6 encountered a few small problems, although the problem is small, but wasted a lot of time, these problems can be said to be vc6 bug, the problem is as follows: 1. the reason for unexpected end of file while looking for precompiled header directive is unclear. This problem does not occur in general projects, this problem occurs mainly because I used the camerads class I wrote by Shi about the no-Installation of dxshow (solving this problem is a very painful process ), solution: Project-> Settings-> All configurations-> C/C ++-> pre-compiled header files-> automatic use of pre-compensated headers 2. when the CRT Library and the MFC library are connected in the wrong sequence in Visual C ++, The lnk2005 error is returned and Microsoft's answer is displayed. URL: http://support.microsoft.com/kb/148652/zh-cn. when the link sequence between the C Runtime (CRT) Library and the Microsoft basic class (MFC) Library is incorrect, one of the following lnk2005 errors may occur: nafxcwd. lib (afxmem. OBJ): Error lnk2005: "Void * _ cdecl operator new (unsigned INT )"(?? 2 @ yapaxi @ Z) alreadydefined in libcmtd. lib (New. OBJ) nafxcwd. lib (afxmem. OBJ): Error lnk2005: "Void _ cdecl operator Delete (void *)"(?? 3 @ yaxpax @ Z) already definedin libcmtd. lib (dbgnew. OBJ) nafxcwd. lib (afxmem. OBJ): Error lnk2005: "Void * _ cdecl operator new (unsigned int, Int, char const *, INT )"(?? 2 @ yapaxihpbdh @ Z) already defined in libcmtd. lib (dbgnew. OBJ) mfcs40d. lib (dllmodul. OBJ): Error lnk2005: _ dllmain @ 12 already defined inmsvcrtd. lib (dllmain. OBJ) mfcs42d. lib (dllmodul. OBJ): Error lnk2005: _ dllmain @ 12 already defined inmsvcrtd. lib (dllmain. OBJ) back to the top. The CRT library uses weak external links for new, delete, and dllmain functions. The MFC Library also contains the new, delete, and dllmain functions. These functions need to be linked to the MFC Library first, and then to the CRT library. Back to the top solution. There are two solutions to this problem. The first method is to force the linker to link the database in the correct order. The second method is to find and correct the module that causes the problem. Note: The following steps are based on Visual C ++ 6.0. Back to Top solution 1: force the linker to link to the database in the correct order 1. on the project menu, click set ". 2. In the "settings of the following projects" view in the "Project Settings" dialog box, click to select the project configuration with a link error. 3. On the "Link" tab, click to select "input" in the "category" combo box ". 4. In the ignore library box, insert the library name (for example, nafxcwd. Lib; libcmtd. Lib ). Note: The equivalent linker command line is:/nod: <library name>. 5. In the "Object/Library module" box, insert the database name. Make sure that these libraries are listed in sequence and are the first two libraries in the row (for example, nafxcwd. lib and libcmtd. Lib ). To set this option in Visual C ++. net, read the online help topic "Set Visual C ++ Project Properties. 3. error c2833: 'operator debug_new 'is not a recognized operator or type is also found on the Internet. This is a bug in vc6 compilation. If 2005 is used, the cause and solution are as follows: symptom: when compiling an application (in which a header file has just been changed) the Microsoft Visual C ++ compiler generates the compiler error :... /include/crtdbg. H (536): Error c2833: 'operator debug_new 'is not a recognized operator or type followed by in excess of 20 Error S. cause normally the compiler error c2833 means that the specified symbol is not recognized and this indicates a simple programming error. this specific error, in 'crtdbg. h 'volving' operator debug_new ', is a compiler bug. this bug has been observed in Visual Studio 5 and Visual Studio 6 (up to and including Service Pack 5 ). possible remedies: these remedies deal with the compiler bug only. * Try Recompiling. this sometimes cures the problem. * If recompiling does not cure the problem then 'clean' the affected project and rebuild. this has always been observed to cure the problem. * Anders musikka has contributed the following tip: it is not necessary to do a full clean of the project and rebuild. you can just delete the xxx. PCH file in the debug/release directory and recompile the failed. CPP file (s ). whilst it is in no way conclusive, this bug may be related to the project precompiler header settings. I have noticed that it only seems to affect projects where the precompiled headers is set to 'automatic use of precompiled headers '. after writing a lot, it is actually to clear the debug file and recreate it.

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.