Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

fatal error LNK1104: cannot open file 'mfc42.lib'

1,013 views
Skip to first unread message

huang

unread,
Sep 28, 2009, 5:31:17 AM9/28/09
to
I am trying to transform my project from VC6.0 to VC2005. But I encounter
the problem "fatal error LNK1104: cannot open file 'mfc42.lib'". How can I
solve it? Help me!


David Lowndes

unread,
Sep 28, 2009, 9:30:04 AM9/28/09
to
>I am trying to transform my project from VC6.0 to VC2005. But I encounter
>the problem "fatal error LNK1104: cannot open file 'mfc42.lib'". How can I
>solve it? Help me!

Since you've moved to a newer version of MFC you shouldn't be trying
to link against that old version. Does your project perhaps have these
library names in the linker settings - there's usually no need to have
these.

Dave

Joseph M. Newcomer

unread,
Sep 28, 2009, 10:54:52 AM9/28/09
to
In addition, if you have any older .obj files, they might contain the equivalent of
#pragma comment(lib, "mfc42.lib")
which means you are trying to link new object files with older object files. In general,
this won't work. You have to make sure that everything in your link, including any
third-party MFC components, are built with the current compiler you are using.

A simple check: open the .vcproj file in a text editor and see if mfc42 appears anywhere
(be VERY careful if you choose to edit these files; you can render the project unloadable
into VS if you mess them up! Always make a backup copy first!) Often what I do is use
the information from the search to home in on the correct place to change the settings
using VS (it is a real royal pain that the 'project settings' are not searchable!)
joe

Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm

huang

unread,
Sep 29, 2009, 9:46:22 PM9/29/09
to
Thanks for your help. I search "mfc42" in project file and all the files in
the project folder,
there is not "mfc42". But there are some third-party MFC components(DLLs) in
my project.
Do those cause this problem ?


"Joseph M. Newcomer" <newc...@flounder.com> wrote in message
news:8aj1c555btru123ml...@4ax.com...

David Lowndes

unread,
Sep 30, 2009, 3:25:53 AM9/30/09
to
>Thanks for your help. I search "mfc42" in project file and all the files in
>the project folder,
>there is not "mfc42". But there are some third-party MFC components(DLLs) in
>my project.

If they're just DLLs that you use, they shouldn't be a problem to the
building of your application. However, if they're source components
that you build, or you have some static libraries that depend on the
old MFC lib, then they may be the cause.

Dave

Scot T Brennecke

unread,
Sep 30, 2009, 3:32:12 AM9/30/09
to
Quite probably. If any of these third-party DLLs depend on MFC42, and you have included their headers and linked with their import
libraries, you are inheriting a dependency on MFC42. This is no good. You need to get update versions of those third-party
components. Serious software vendors should not be still creating their products with VC6.
0 new messages