in VS2008 I created a project from the MFC template. Everything is working. Next, connect the third-party dll. Compilation is successful. However, when you start the application, it swears at the absence of MSVCP90.dll. The search showed that such files are located in subfolders of the C: \ Windows \ winsxs directory. Similarly, in C: \ Program Files (x86) \ Microsoft Visual Studio 9.0 \ VC \ redist. The method of "scientific tyke" from the example (it seems to have been created in VS2008), supplied with a plug-in dll, copied a piece of code into the project:
#ifdef _DEBUG #ifdef _M_IX86 #pragma comment(linker,"/manifestdependency:\"type='win32' " "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' " "version='" _CRT_ASSEMBLY_VERSION "' " "processorArchitecture='x86' " "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"") #pragma comment(linker,"/manifestdependency:\"type='win32' " "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".MFC' " "version='" _MFC_ASSEMBLY_VERSION "' " "processorArchitecture='x86' " "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"") #else #pragma comment(linker,"/manifestdependency:\"type='win32' " "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' " "version='" _CRT_ASSEMBLY_VERSION "' " "processorArchitecture='amd64' " "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"") #pragma comment(linker,"/manifestdependency:\"type='win32' " "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".MFC' " "version='" _MFC_ASSEMBLY_VERSION "' " "processorArchitecture='amd64' " "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"") #endif #endif and it all worked.
- Why without this code exe-shnik can not find the necessary dll?
- Where in the project the directives #ifdef _DEBUG and #ifdef _M_IX86 are defined, that the condition becomes true? Somewhere in the project properties?
- Explain the essence of this code. And how it affects the search for the desired dll. I don’t remember what they wrote in the book. Or give a link where it is well written.
- If you create a similar MFC project in VS2010, that with this piece of code, that without, swears at the absence of MSVCP90.dll. I noticed if you create a project in VS2008 with this piece of code. Then open it in VS2010 and in the settings put the Platform toolset v90, then it works. How, initially creating a project in VS2010, point to this dll?
Thank.