Exception thrown at 0x00007FFC45507C1D (mfc140ud.dll) in InsertUnitPart.exe: 0xC0000005: Access viol

Build seccessful, But When we running the application, faced this Exception:

Exception thrown at 0x00007FFC45507C1D (mfc140ud.dll) in InsertUnitPart.exe: 0xC0000005: Access violation reading location 0x0000000000000000.

原因(仅限于我的工程配置):

解决办法:Unicode -> No Set

问题探究->:
Is it because of my project settings?

Yes, the project settings can definitely influence how your application behaves, and issues like the access violation you're encountering can often be traced back to configuration or build settings. Here are some specific project settings and configurations you should check to diagnose the problem:

1. Configuration Type

  • Ensure you are building the correct configuration (Debug vs. Release). Debug configurations include additional debugging information and error checking that can help catch issues more effectively.

2. Character Set

  • Check the character set settings in your project. If your project is using Unicode, ensure that all string handling appropriately matches that (i.e., using CStringW for wide strings). Mismatched character types can lead to unexpected behavior.

3. MFC Usage

  • If you're using MFC, verify that your project is indeed set up to use MFC as either a shared or static library. Go to Project Properties ➔ General ➔ Use of MFC and ensure it is correctly configured.

4. Runtime Library

  • Ensure that you are using the correct runtime library settings. Under C/C++ ➔ Code Generation, verify that the runtime library setting matches your build type. Using /MD for Release and /MDd for Debug is standard for MFC applications.

5. Additional Include/Library Directories

  • If you're using any third-party libraries along with MFC, make sure all the necessary include paths and library paths are correctly set under C/C++ ➔ General and Linker ➔ General.

6. Preprocessor Definitions

  • Check your preprocessor definitions under C/C++ ➔ Preprocessor. Ensure that any definitions required for MFC or your project dependencies are included, especially for conditional compilation.

7. Linker Settings

  • Validate the linker settings to ensure that all necessary libraries are linked. Check under Linker ➔ Input to confirm that you are linking against mfc140ud.lib (for Debug) or the appropriate release version.

8. Manifest and Dependency Settings

  • If you require certain Windows features or permissions, check if your application manifest is set up correctly. Under Linker ➔ Manifest, ensure it is correctly configured to your needs.

9. Compile-Time Options

  • Ensure that compile-time options (like optimizations and security checks) do not interfere with your application logic. Sometimes aggressive optimization can lead to unexpected behavior.

10. Debugging Options

  • Make sure that you have debugging enabled in your project settings. Check Debugging ➔ General to enable options like "Enable Just My Code", which might help isolate problems.

Steps to Diagnose Further

  1. Rebuild the Solution: Sometimes, simply doing a clean and rebuild can fix mysterious issues caused by stale object files or mismatched dependencies.

  2. Change Runtime Library: Try changing the runtime library (from Multi-threaded to Multi-threaded Debug or vice versa) to see if that resolves the issue.

  3. Check Compatibility: Ensure that your project settings are compatible with the version of Visual Studio you are using, especially if you recently upgraded or changed systems.

  4. Examine Output Window: Use the Visual Studio Output window during build and debug to catch any additional warnings or errors that might provide more insight into configuration issues.

Summary

Your project settings can greatly influence runtime behavior and stability. Thoroughly checking the configurations related to MFC, character sets, runtime libraries, and linker inputs can help identify the cause of the access violation. If none of these solutions work, consider sharing your project settings or specific configuration details for more targeted advice.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值