upgrading VS6 to VS.NET2003, MFC linkage
-
I was trying to upgrade a C++/MFC project from VS6 to VS.NET 2003 and hit a linker problem that I cannot explain. Can one of you? I was expecting the MFC linkage to occur to MFC7x, but the linkage fails with linker error "cannot find mfc42d.dll". I understand that the linker cannot find that dll (it's nowhere in the library search patch), but why does it look for it in the first place? How is the desired MFC version adjusted or determined? There is no reference in the project preferences to that dll, or to anything else that looks remotely like "mfc42". I am building a DLL, which itself links to several DLLs via import libraries. These other DLLs are linked to MFC42, would that require the primary DLL to be linked to MFC42 as well? Any thoughts are welcome. TIA, Bernd
-
I was trying to upgrade a C++/MFC project from VS6 to VS.NET 2003 and hit a linker problem that I cannot explain. Can one of you? I was expecting the MFC linkage to occur to MFC7x, but the linkage fails with linker error "cannot find mfc42d.dll". I understand that the linker cannot find that dll (it's nowhere in the library search patch), but why does it look for it in the first place? How is the desired MFC version adjusted or determined? There is no reference in the project preferences to that dll, or to anything else that looks remotely like "mfc42". I am building a DLL, which itself links to several DLLs via import libraries. These other DLLs are linked to MFC42, would that require the primary DLL to be linked to MFC42 as well? Any thoughts are welcome. TIA, Bernd
Somewhere in your project is code that is still compiled for VC6. You will need to recompile everything to remove all references to MFC42D.dll. Also note that this is the debug version of the DLL.
Software Zen:
delete this;
-
Somewhere in your project is code that is still compiled for VC6. You will need to recompile everything to remove all references to MFC42D.dll. Also note that this is the debug version of the DLL.
Software Zen:
delete this;
Thanks. The project itself has been cleaned and re-built at no avail. You didn't mention the import libraries, but I believe these should not cause the problem anyhow. How about function libraries, thought? Surely these must be rebuilt for MFC7, too? Hmm, that's like opening a can of worms. I guess I can not link the application to both MFC42 and MFC71 at the same time, right?
-
I was trying to upgrade a C++/MFC project from VS6 to VS.NET 2003 and hit a linker problem that I cannot explain. Can one of you? I was expecting the MFC linkage to occur to MFC7x, but the linkage fails with linker error "cannot find mfc42d.dll". I understand that the linker cannot find that dll (it's nowhere in the library search patch), but why does it look for it in the first place? How is the desired MFC version adjusted or determined? There is no reference in the project preferences to that dll, or to anything else that looks remotely like "mfc42". I am building a DLL, which itself links to several DLLs via import libraries. These other DLLs are linked to MFC42, would that require the primary DLL to be linked to MFC42 as well? Any thoughts are welcome. TIA, Bernd
Two words for you: static link! But as you (and others) have said, *everything* will need to be rebuilt with MFC 7.0 or you will have problems. This includes any supporting static libraries your project uses. Remember, even if you win the rat race, you're still a rat.
-
Thanks. The project itself has been cleaned and re-built at no avail. You didn't mention the import libraries, but I believe these should not cause the problem anyhow. How about function libraries, thought? Surely these must be rebuilt for MFC7, too? Hmm, that's like opening a can of worms. I guess I can not link the application to both MFC42 and MFC71 at the same time, right?
The source of the problem can be in any piece that's referenced in the linking process: object files in your project, import libraries, or 'function' libraries. You've rebuilt your entire project under VS.NET, so the object files in your project should not be the problem. Import libraries are object libraries that contain stub functions that correspond to the actual functions in a DLL. These stub functions take care of loading the library and then calling the actual DLL function for you. An import library is associated with a specific DLL. If you link to an import library that was compiled under VC6, you will need the MFC42* DLL's. By 'function' libraries, I assume you mean object libraries. If any of these object libraries were compiled under VC6, you will probably also need the MFC42* DLL's. berndg wrote: I guess I can not link the application to both MFC42 and MFC71 at the same time, right? I don't believe so. You would have two different copies of MFC loaded, with the corresponding mix of state information. I doubt this would work well, if at all.
Software Zen:
delete this;