471,073 Members | 1,279 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,073 software developers and data experts.

[VS 2005] problem importing abstract class with interface


To reproduce my problem I have created a solution with 4 projects:

1) CalledCpp - a cpp managed dll
2) CallerCpp - a cpp managed console project that depends on CalledCpp
3) CallerVB - a vb console project that depends on CalledCpp
4) CallerCS - a csharp console project that depends on CalledCpp

The main file of CalledCpp (CalledCpp.cpp) contains this code:

#include "stdafx.h"
#include "CalledCpp.h"


namespace CalledCpp

public interface class IoInterface
#if defined(USE_INTERFACE)
void read();

public ref class MyBase abstract : IoInterface
static MyBase^ Create();
#if !defined(USE_INTERFACE)
virtual void read() abstract;

public ref class Derived : MyBase
void read();

MyBase^ MyBase::Create()
return gcnew Derived();

void Derived::read()

The main file of CallerCpp (CallerCpp.cpp) contains this code:

#include "stdafx.h"

using namespace System;

int main()
CalledCpp::MyBase^ bas = CalledCpp::MyBase::Create();

The main file of CallerCS (Program.cs) contains this code:

#region Using directives

using System;
using System.Collections.Generic;
using System.Text;


namespace CallerCS
class Test
static void Main(string[] args)
CalledCpp.MyBase bas = CalledCpp.MyBase.Create();
The main file of CallerVB (Module1.vb) contains this code:

Module Module1

Sub Main()
Dim bas As CalledCpp.MyBase = CalledCpp.MyBase.Create()
Call bas.read()
End Sub

End Module
Now, CallerCpp, CallerCS and CallerVB have a project reference to CalledCpp.

If I perform a RebuildAll only CallerCpp builds fine while CallerVB and
CallerCS build return the same error:

error CS0117: 'CalledCpp.MyBase' does not contain a definition for 'read'

If I undefine USE_INTERFACE all works fine.

TIA for any help.
For direct reply change underscore to dot

Nov 17 '05 #1
0 738

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.