1

I am trying to call a method of a c++ class that uses a string parameter but I have this error

Error CS0570 'Wrapper.write(int, ?)' is not supported by the language

Basically I have this code, and it works with other simple methods without string object

I read this but as they are not static methods I can't use it

Any idea?

In C#

Wrapper tb = new Lib.Wrapper();
tb.write( 1, "tablas.txt");

In C++ Lib.h

private:
     myCppClass* pMyCppClass;
public:
     Wrapper();
     int write(int id, String^ file);

And C++ Lib.cpp

int Lib::Wrapper::write(int id, String^ file)
{
     std::string aux= marshal_as < std::string > (file);    
     return pMyCppClass->write(id, aux);
}
Community
  • 1
  • 1
jgrdpy
  • 35
  • 1
  • 6

1 Answers1

0

I figured out the libraries wasn't updating so I delete the dll, clean the solution, recompile and add again the reference in C# and it works

jgrdpy
  • 35
  • 1
  • 6