An error occurred when compiling the program in VS 2013:
Error message 1:
error C1189: #error: Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
Reason :
The conventional one is: use MFC in the static library, or use the standard Windows library, at this time, no matter what it is, an error may be reported.
The multi-threaded debugging in the runtime library is: MDd (multi-threaded debugging DLL)
Solution :
Change MDd to MTd. If error 2 is reported after correction, change it as follows.
Error message 2:
error C1189: #error: Please use the /MD switch for _AFXDLL builds
Reason :
The conventional one is: use MFC in a shared DLL,
The multi-threaded debugging in the runtime library is: MTd (multi-threaded debugging)
Solution :
Change the general to: use MFC in the static library, or use the standard Windows library
Conventional and runtime libraries are as follows:
General: Right-click the project -> Properties -> Configuration Properties -> General, and then select “Use MFC in a static library” in the “Use of MFC” option in the “Project Defaults” on the right,
Multi-threaded debugging: Right-click the project–>Properties->Configuration Properties->c/c++->Code Generation->Runtime Library->Multithreaded Debugging (/MTd)
Related notes:
There are three settings for the use of MFC :
1. Use standard Windows libraries
2. Use MFC in the static library: it is to write the relevant code in the DLL into the EXE file, the file is larger, but it can be run on the machine without the relevant DLL;
3. Use MFC in a shared DLL: It means that the content of some MFC DLLs is not included in the EXE file when packaging, so the EXE file is small, but the system requires related DLL files at runtime;
Multi-threaded debugging
/MD: Use multithreading in the dll to create the release version of the dynamic link library, which needs to be selected.
/MT: Use multithreading in exe to create a release version of exe, which needs to be selected.
/MTd: Same as /MT, but used in the Debug version.
/MDL: Same as /MD, but used in the Debug version.
If it is Debug’s “Use MFC in a static library”, don’t use MDd, use MTd instead, and then compile it to pass.
If it is Debug’s “Use MFC in shared DLL”, be careful not to use MTd, use MDd instead;
If it is the Release version “use MFC in static library”, don’t use MD, use MT;
If it is the Release version of “Use MFC in a shared DLL”, do not use MT, use MD.
Read More:
- [Solved] OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
- [Solved] OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
- C++ Use of deleted function error
- error: switch `b‘ requires a value [How to Solve]
- [Solved] error C4996: ‘QWheelEvent::pos‘: Use position()
- Linux C++ Error: invalid use of incomplete type [How to Solve]
- Error starting vue project these dependencies were not found:create in ./src/router/modules/md.js
- github Error: Logon failed, use ctrl+c to cancel basic credential prompt.
- Nexus3 builds Jenkins error: Not authorized (Downloading dependent jar package error)
- MindSpore Error: [ERROR] MD:unexpected error.Not a valid index
- How to Solve Fatal error stdatomic in C/C++ Compilation
- C++:error C2872: ‘byte‘: ambiguous symbol [How to Solve]
- Cmake Setting Support C++11 This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options
- Grpc Compilation issues: “C++ versions less than C++11 are not supported.
- [Solved] URIError: Failed to decode param ‘/%3C%=%20BASE_URL%20%3Estatic/index.%3C%=%20VUE_APP_INDEX_CSS_HASH%20%3E.css’
- Cannot start container 39f96c64a9c6: [8] System error: exec format error
- bazel Compile Error: absl/base/policy_checks.h:79:2: error: #error “C++ versions less than C++14 are not supported.”
- [Solved] Error: error C2601: ‘b‘ : local function definitions are illegal error C2063: ‘b‘ : not a function
- [Solved] error C2041: illegal digit ‘9‘ for base ‘8‘ | error C2059: syntax error: ‘bad suffix on number‘
- Error c4996: ‘getversionexa’: declared rejected [How to Solve]