When a non-MFC project uses a static link to MFC, the external symbol coinitialize cannot be parsed.

Source: Internet
Author: User

Developed a demo for converting from WAV to WMA under vs2005 (not MFCProgram). In this demo, convert wav to WMA using Windows Media Format SDK 9.0. I used it well in my development environment, but when I moved to a platform without the vs2005 Development Environment (Windows XP), the prompt "because the application configuration is incorrect, the application failed to start. "Re-installing the application may correct this problem ."

I found information from the Internet

 

 

In Project Properties> Configure Properties> C/C ++> -〉 Code There is a Runtime Library in the generation,
The default option of. Net 05 is multi-threaded DLL. Change it to multi-threaded.

Later, I spent some time testing and found that you do not need to modify the compilation options, as long as the program files/Microsoft Visual Studio
8. Microsoft. vc80.mfc. manifest and Microsoft. vc80.crt. manifest of the corresponding platform in VC/redist
Copy it to the application directory. If you still use the ATL library, you also need Microsoft. vc80.atl. manifest.

Summary: There are two methods I know to solve this problem,

1. Modify the project properties and link the MFC Library statically (the multi-threaded DLL mentioned above is automatically changed to multithreading when the link is static ).

2. include Microsoft. vc80.mfc. manifest and Microsoft. vc80.crt. manifest.

 

 

If the above method 1 is used to statically link the MFC library, a compilation error occurs:

Error lnk2019: the external symbol _ imp _ coinitialize @ 4 that cannot be parsed. This symbol is referenced in function _ main.

 

Because it is not an MFC project

Include <afxwin. h> // MFC core and standard components

 

After the afxwin. h file is included, the world is finally quiet.

 

 

 

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.