There is actually an error in your code:
You're redeclaring the same enum as an unmanaged one.
Try something like this:
static __value enum eEnumType_MCPP m_eEnumType_MCP P2;
--
Silviu Guea, Visual C++ Team
This posting is provided AS IS with no warranties, and confers no rights.
--------------------
| From: Alan Cobb <al***********@ spam.off.alanco bb.spam.off.com >
| Subject: Public managed enum types in MCPP - Compiler warning
| Date: Tue, 27 Apr 2004 16:08:04 -0700
| Message-ID: <9i************ *************** *****@4ax.com>
| X-Newsreader: Forte Agent 1.92/32.572
| MIME-Version: 1.0
| Content-Type: text/plain; charset=us-ascii
| Content-Transfer-Encoding: 7bit
| Newsgroups: microsoft.publi c.dotnet.langua ges.vc
| NNTP-Posting-Host: 177.119-30-64.ftth.swbr.su rewest.net 64.30.119.177
| Lines: 1
| Path:
cpmsftngxa10.ph x.gbl!TK2MSFTFE ED01.phx.gbl!TK 2MSFTNGP08.phx. gbl!TK2MSFTNGP1 1
.phx.gbl
| Xref: cpmsftngxa10.ph x.gbl microsoft.publi c.dotnet.langua ges.vc:36168
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.vc
|
| Hi,
|
| In the managed C++ class below I get compile warning C4677
| from VS2003. "signature of non-private function contains
| assembly private type", even though the managed enum is
| public. I have to drop the "enum" keyword from my member
| variable declaration to keep the compiler happy.
|
| Shouldn't I technically be able to use the "enum" keyword
| without a warning?
|
| Thanks,
| Alan Cobb
|
| namespace MCPP_ClassLib1
| {
| public __value enum eEnumType_MCPP { eMem1, eMem2 };
|
| public __gc class Class_MCPP // Managed class
| {
| public:
| // The compiler likes this:
| static eEnumType_MCPP m_eEnumType_MCP P1;
|
| // The compiler gives a warning C4677 for this:
| // 'm_eEnumType_MC PP2': signature of non-private
| // function contains assembly private type
| // 'MCPP_ClassLib1 ::eEnumType_MCP P'
| //
| // static enum eEnumType_MCPP m_eEnumType_MCP P2;
| };
| }
|
| For reference:
|
http://msdn.microsoft.com/library/en...c.2b2b_.enumer
ation_declarati ons.asp
|