You may receive an "Error C2039: 'GetObjectA' : is not a member of 'System::Resources::ResourceManager'" error message when you use the ResourceManager class in Visual C++ .NET 2003 (888267)
The information in this article applies to:
- Microsoft Visual C++ .NET (2003)
SYMPTOMSYou use Microsoft Visual Studio C++ .NET 2003 to create a Microsoft Windows Forms-based project that creates an instance of the
ResourceManager class. When you build the project, you may receive an error message that is
similar to the following: c:\Documents and Settings\UserName\My Documents\Visual
Studio Projects2\Listbox\Form1.h(100) : error C2039: 'GetObjectA' : is not a
member of 'System::Resources::ResourceManager' stdafx.cpp(0) : see declaration
of 'System::Resources::ResourceManager' CAUSEThis problem occurs because a #define statement in the Windows.h
header file of the Windows Form changes the name of the GetObject function to
GetObjectA or to GetObjectW.
The #define
statement is applied to the GetObject function of the
ResourceManager class. However the .NET Framework does not use
the A and W naming convention. Therefore, you experience this problem.
Sometimes, function names and class names are the same in managed code and
in unmanaged code. For example, your code may contain both the MessageBox function and the MessageBox class.WORKAROUNDMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. To work around this problem, follow these steps: - Add
code that is similar to the following to your project. Add this code before your managed code that uses the
ResourceManager class.
#ifdef GetObject
#pragma message("Undefine the GetObject function for your managed code.")
#pragma push_macro("GetObject")
#undef GetObject
#endif - Add
code that is similar to the following to your project. Add this code after your managed code that uses the
ResourceManager class.
#ifndef GetObject
#pragma message( "Redefine the GetObject function to the unmanaged code definition.")
#pragma pop_macro("GetObject")
#endif
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are
listed in the "Applies to" section.
Modification Type: | Minor | Last Reviewed: | 1/12/2006 |
---|
Keywords: | kbnofix kbBug KB888267 kbAudDeveloper |
---|
|