compie error CS0117

  • Thread starter Thread starter B.
  • Start date Start date
B

B.

Hi I have two projects, one written in MC++, and the other in C#.
In MC++ header file, I have:

namespace Domain
{
namespace Subdomain
{
namespace ManagedCPP
{
public class AClass
{
static void OpenWindow();
};
}
}
}

In MC++ cpp file: I have:

using namespace Domain::Subdomain::ManagedCPP;

void AClass::OpenWindow()
{
// some implementaion
}

And now in C#, I have
using namespace Domain.Subdomain.ManagedCPP;

namespace OtherDomain.Framework.UI
{
public class BClass
{
public MethodA()
{
AClass.OpenWindow();
}
}
}

I got the error CS0117: Domain.Subdomain.ManagedCPP.AClass does not
contain a definition for 'OpenWindow'

Anybody can help???
Thanks a lot
 
B. said:
Hi I have two projects, one written in MC++, and the other in C#.
In MC++ header file, I have:

namespace Domain
{
namespace Subdomain
{
namespace ManagedCPP
{
public class AClass
{
static void OpenWindow();
};
}
}
}

In MC++ cpp file: I have:

using namespace Domain::Subdomain::ManagedCPP;

void AClass::OpenWindow()
{
// some implementaion
}

And now in C#, I have
using namespace Domain.Subdomain.ManagedCPP;

namespace OtherDomain.Framework.UI
{
public class BClass
{
public MethodA()
{
AClass.OpenWindow();
}
}
}

I got the error CS0117: Domain.Subdomain.ManagedCPP.AClass does not
contain a definition for 'OpenWindow'

Anybody can help???
Thanks a lot

Have you tried using the ildasm utility to examine the DLL generated by
the managed C++ compiler to see what the class structure looks like
after the compiler is finished with it?
 
Bruce said:
Have you tried using the ildasm utility to examine the DLL generated by
the managed C++ compiler to see what the class structure looks like
after the compiler is finished with it?


No I didn't. However, I use F12 on AClass at C# side, it opens metadata
of AClass and it says struct AClass{} and no method in side at all.
 
B. said:
No I didn't. However, I use F12 on AClass at C# side, it opens metadata
of AClass and it says struct AClass{} and no method in side at all.

Well, I'm rusty on my C++ access modifiers, so I can't say for sure,
but you said simply "static void OpenWindow". What's the default access
for a method in C++? In C# it's "internal", which would mean
"inaccessible to other assemblies"...? Perhaps you need to specifically
say "public static void OpenWindow"?
 
I actually had modifiers "public" specified.

Bruce said:
Well, I'm rusty on my C++ access modifiers, so I can't say for sure,
but you said simply "static void OpenWindow". What's the default access
for a method in C++? In C# it's "internal", which would mean
"inaccessible to other assemblies"...? Perhaps you need to specifically
say "public static void OpenWindow"?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top