c# 4.0 - C++/CLI Interface is not visible from my C# Class -
i have interface in c++/cli need implement in c#, not visible. have other classes (abstract , concrete can inherit from).
my c++/cli interface:
namespace mynamespace { namespace mysubnamespace { public interface class itestinterface { public: property bool firstproperty { bool get(); } property bool secondproperty { bool get(); } }; }}
i have test project use functionality in managed library, interface never becomes visible.
how try use in c# test project: (i tried using class library project also, , doesn't work either).
public class test: mynamespace.mysubnamespace.itestinterface { }
i "cannot resolve symbol 'itestinterface'"
what missing?
update
i kept trying different things following comments question, , found if include .h file in other .h file of c++/cli project, class becomes visible. do:
#include "itestinterface.h"
in 1 of other .h files of c++/cli project , class becomes visible c# project.
is there way avoid doing that?
c++/cli similar c++ in .cpp files compiled directly. header files compiled when included. why adding #include
interface header works.
there several ways make sure code included c++/cli class:
- have both .h , .cpp file (even if .cpp file includes .h file corresponds to)
- have include files , include of headers in 1 .cpp file (which may empty other includes)
- have .cpp files (which fine if other code not reference code)
Comments
Post a Comment