Re: Visual C++ Tools Refresh ready today

From: jwaterloo (jwaterloo.1bx9tq_at_mail.codecomments.com)
Date: 09/01/04


Date: Wed, 1 Sep 2004 12:58:24 -0500


Brandon Bray [MSFT] wrote:
> *Ben Schwehn wrote:
> > Second, when trying to compile a .net project (e.g a brand new
> .net
> > console or library project) that has <windows.h> included i get
> many
> > linker errors like the one below:
> >
> > MSVCMRTD.lib(mstartup.obj) : error LNK2022: metadata operation
> failed
> > (80131195) : Custom attributes are not consistent: (0x0c000002).
> > [...]
> > LINK : fatal error LNK1255: link failed because of metadata errors
> >
> >
> > Any idea how to fix this?
>
> It took a little bit to track this down, but we did it. This is
> caused
> because we moved the NativeEnumAttribute from Microsoft.VisualC.dll
> to
> another assembly. The managed CRT has a few enums (probably from
> windows.h)
> that have the old location, while your code has the new location. (I
> personally think the Attribute shouldn't even be there).
>
> Anyways, this is fixed by building with a newer msvcmrt.lib or
> msvcmrtd.lib.
> We will package that and provide it with the next refresh. We'll try
> to get
> that done next week.
>
> I'm sorry for the inconvenience.
>
> --
> Brandon Bray, Visual C++ Compiler
> [url]http://blogs.msdn.com/branbray/[/url]
> This posting is provided AS IS with no warranties, and confers no
> rights. *
I am wanting to use Windows Forms with MFC but was disappointed with
Visual Studio 2005 Beta. My heart rejoiced when I found out that there
was a tools refresh. So, I immediate tried to get my existing project
to work with it. Since then I have had 2 problems, one in release and
the other in the debug build.

In the release build, I received numerous errors stating that the
CWinFormsEventsHelper class does not have a get_Control() method. I
fixed this by changing 'afxwinforms.inl'. The changes are below with
the original commented out and the revisions just below it.

_AFXWIN_INLINE System::Windows::Forms::Control^
CWinFormsControlSite::get_Control() const
        {
                //System::Windows::Forms::Control^
pControl=m_gcEventHelper->get_Control();
                //ENSURE((CWinFormsEventsHelper^)m_gcEventHelper!=nullptr &&
pControl!=nullptr);
                //return pControl;
                ENSURE((CWinFormsEventsHelper^)m_gcEventHelper!=nullptr);
                System::Windows::Forms::Control^ pControl=m_gcEventHelper->Control;
                ENSURE(pControl!=nullptr);
                return pControl;
        }

When I made these corrections and re-compiled. My release build
generated the same errors as found in my debug build. They are as
follows:

101 instances of:
MSVCMRT.lib(mstartup.obj) : error LNK2022: metadata operation failed
(80131195) : Custom attributes are not consistent: (0x0c000002).

Followed by one instance of:
LINK : fatal error LNK1255: link failed because of metadata errors

I am thankful that someone else have already found this error, that you
have diagnosed it and have committed to fixing it in one week (as of
August 28). My questions are as follows:

1) Where will the fix be made available so that I won't be
re-downloading the original Tools Refresh?

2) Will it still be out this week? [Today is September 1]

3) Was it ok to make the change to the 'afxwinforms.inl' file so that
my release build will generate the same error as the debug? Will that
be in the Update or will I need to make that change again?

--
jwaterloo
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------
 


Relevant Pages