开发者

VS2008 C# error ".ctor' not supported by language

开发者 https://www.devze.com 2022-12-29 06:13 出处:网络
C# code: class Program { static void Main(string[] args) { TFWrapper tf; String lexDir = \".......\"; String lic = \"........\";

C# code:

class Program
{
    static void Main(string[] args)
    { 
        TFWrapper tf;
        String lexDir = ".......";
        String lic = "........";
        String key = ".........";
        ArrayList cats = new ArrayList();
        Boolean useConj = false;
        String lang = "english";
        String encoding = "auto";
        tf = new TFWrapper(lexDir, lic, key, cats, useConj, lang, encoding);
    }
}  

Managed C++ method being called:

TFWrapper::TFWrapper(String^ mlexDir, String^ mlic, String^ mkey, ArrayList catList, Boolean^ m_useConj, String^开发者_开发知识库 m_lang, String^ m_encoding);  

Getting '.ctor' is not supported by the language error on the last line of C#


Just a hunch, but I think you need to change

ArrayList catList, Boolean^ m_useConj

to

ArrayList^ catList, Boolean m_useConj

Because Boolean is a value type and ArrayList a reference type.


Try calling this in your C#:

tf = new TFWrapper(lexDir, lic, key, cats, useConj, lang, encoding);

Also, in your C++ declaration, shouldn't ArrayList catList be ArrayList^ catlist?

0

精彩评论

暂无评论...
验证码 换一张
取 消