By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,294 Members | 2,484 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,294 IT Pros & Developers. It's quick & easy.

Problem referencing Managed class from the Unmanaged one

P: n/a
I have defined a managed class ( __gc ) and a unmanaged ( __nogc ) in a
separate files (but in the same vc++ dotnet project). I have no problem of
referencing the unmanaged class from the menaged one. My problem is that I
cannot reference managed class from the unmanaged.

In my unmanaged class, if I use "using namespace ManagedNamespace;" I get
error C2871: a namespace with this name does not exist. I get the simmilar
error when trying to reference the Managed class directly from the unmanaged
class methods.

If i use "#include ".\ManagedClass.h" I get syntax errors in that header
file (and it was compiling OK before referencing it from the unmanaged
class).

When I copy the unmanaged class to the same file where the managed is,
everything seems ok. Unfortunately, I must keep them separate.

Can anybody help?

Thanks,
Sasha
Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
A small repro case would be the fastest way to get a concrete solution to
this.

Thanks.

Ronald Laeremans
Visual C++ team

"Sasha Nikolic" <sa***@dmdsecure.com> wrote in message
news:OD**************@TK2MSFTNGP09.phx.gbl...
I have defined a managed class ( __gc ) and a unmanaged ( __nogc ) in a
separate files (but in the same vc++ dotnet project). I have no problem of
referencing the unmanaged class from the menaged one. My problem is that I
cannot reference managed class from the unmanaged.

In my unmanaged class, if I use "using namespace ManagedNamespace;" I get
error C2871: a namespace with this name does not exist. I get the simmilar
error when trying to reference the Managed class directly from the
unmanaged
class methods.

If i use "#include ".\ManagedClass.h" I get syntax errors in that header
file (and it was compiling OK before referencing it from the unmanaged
class).

When I copy the unmanaged class to the same file where the managed is,
everything seems ok. Unfortunately, I must keep them separate.

Can anybody help?

Thanks,
Sasha

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.