Vc6 compilation and link problems

Source: Internet
Author: User

To clear the directory, delete the DEBUG directory. The following error occurs during compilation:

Fatal error c1083: cannot open precompiled header file:/'debug/xxx. PCH /':

No such file or directory

No way.

The error is due to the same problem:

Fatal error c1010: unexpected end of file while looking for precompiled

Header Directive

Originally, XXX. PCH is the file generated by the Pre-compiled header file. In Project-settings, select the compiled project and C/C ++ page, and select precompiled headers in the drop-down box. The following four options are available.

1. Do not use the pre-compiled header;
2. automatically use the pre-compiled header;
3. Create a pre-compiled header from the first file and specify the header file;
4. Use the pre-compiled header file stdafx. h

If the precompiled header file is stdafx. H, select 4 for all other files, 3 for stdafx. cpp, and stdafx. h for the header file.

When the first compilation error occurs, you only need to recompile stdafx. cpp to generate the pre-compiled XXX. PCH. In the second compilation problem, stdafx. h must be included at the beginning of the file.

Link error:

When a static library is used, the following error occurs:

Libcd. Lib (crt0dat. OBJ): Error lnk2005: _ cinit already defined in libcmt. Lib (crt0dat. OBJ)
Libcd. Lib (crt0dat. OBJ): Error lnk2005: _ exit already defined in libcmt. Lib (crt0dat. OBJ)
Libcd. Lib (crt0dat. OBJ): Error lnk2005: _ exit already defined in libcmt. Lib (crt0dat. OBJ)

This is a conflict between libraries and executable programs that use different libraries. On the project-settings link page of the main program, select the input item in the drop-down box,

Add:
Libc. Lib, msvcrt. Lib, mfc42.lib

For the debug version, it should be:
Libcd. Lib, msvcrtd. Lib, mfc42d. Lib.

In this case, the compilation is successful.

Similar problems:
Error lnk2001: unresolved external symbol _ afxforceexclude

This is because ignore all default libraries is selected. you can remove 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.