15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


mfc42.lib

Svetlana Guljajeva -- svetlana@assert.ee
Tuesday, September 03, 1996

Environment: VC 4.2,Win95

Hello!

I've just installed Visual C++ 4.2 and recompile my project that was written
with VC 4.0.While linking,I got the following errors for every definition
that you can see in afxwin.h :

mfc42d.lib(MFC42D.DLL) : error LNK2005: "public: static struct CRuntimeClass
const
CMDIFrameWnd::classCMDIFrameWnd"(?classCMDIFrameWnd@CMDIFrameWnd@@2UCRuntime
Class@@B) already defined in nafxcwd.lib(winmdi.obj)

With VC 4.0 I had no such a problems.
Does anyone know WHY this error occured here?
Should I change something in my project's Build Settings?

Thanx .
Svetlana.

**svetlana@assert.ee**





Mike Blaszczak -- mikeblas@nwlink.com
Tuesday, September 03, 1996

[Mini-digest: 5 responses]

At 11:59 AM 9/3/96 +0300, you wrote:
>Environment: VC 4.2,Win95


>mfc42d.lib(MFC42D.DLL) : error LNK2005: "public: static struct CRuntimeClass
>const
>CMDIFrameWnd::classCMDIFrameWnd"(?classCMDIFrameWnd@CMDIFrameWnd@@2UCRuntime
>Class@@B) already defined in nafxcwd.lib(winmdi.obj)

>With VC 4.0 I had no such a problems.
>Does anyone know WHY this error occured here?
>Should I change something in my project's Build Settings?

For some reason, you're linking with both the static version of MFC (that is,
you're getting NAFXCWD.LIB) and with the shared library version of MFC
(that is, you're referencing the MFC42D.DLL library).

This suggests that either:

a) You have some modules in your project which compile with "_AFXDLL"
   and some that don't. You need to make sure they're homogenous.
b) You've explicitly included NAFXCW[d].LIB to the linker
c) You've explicitly included MFC42[d].LIB to the linker

.B ekiM
http://www.nwlink.com/~mikeblas/
These words are my own. I do not speak on behalf of Microsoft.

-----From: "Dan Kirby" 

You're trying to link with static and DLL versions of MFC. You need to
examine your link/compile options and make certain that you are doing one
and not both.  Do a "rebuild all" to make certain that everything is
rebuild.

--dan

-----From: Nicholas Van Wyen 

Last week I had a similar problem with name mangling.
The VC42a patch fixes this and can be found at
http://www.microsoft.com/visualc/v42/v42tech/v42a/vc42a.htm

-----From: dima@ssm6000.samsung.ru (Dulepov Dmitry)

        [Mailer: "Groupware E-Mail". Version 1.0]

    Try to change 'Microsoft Foundation Classes' option in the 'Gen=
eral' tab in 'Project Settings' dialog to value other then you have=
 now; rebuild project (don't see on possible errors), and set old v=
alue again.
    Sometimes 4.0 projects opened with 4.2 build incorrectly. Descr=
ibed procedure usually helps.
    Possibly MSVC 4.2 incorrectly imports old projects. I have no o=
ther suggestions.


Dmitry A. Dulepov
Groupware Group
Samsung Electronics Co., Ltd., Russian Research Center
Tel.: +7(095)213-9207
Fax.: +7(095)213-9196
E-Mail (Internet): dima@src.samsung.ru
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-----From: Milind Changire 


Hello Svetlana!

This problem occured to me on VC++ 4.0 as well.

1. If you want to use mfc42d.lib instead of nafxcwd.lib:
   Put mfc42d.lib as the FIRST library in the Linker/Input/Additional Libs
   options. Now try building your project. 

2. If again you get some 'redefinition' errors then do the same as above
   but put each of the libs AFTER mfc42d.lib. 

3. If you get a an error saying 'try using /NODEFAULTLIB' then put the
   corresponding libs under Linker/Input/Ignore Specific Libs
   This applies to the fact that you want to use either multithreaded or
   singlethreaded libs. Put the unwanted libs in the Ignore Libs section.

4. Remember to do the necessary for RELEASE version also.


Hope this helps.

-Milind





| Вернуться в корень Архива |