This must be some basic C++ I am missing out of how to declare an instance ?

I am trying to create an instance of a SFTP. I have added the .DLL file into my project and added the namespace.
Sftp is found as a class in this namespace (SharpSsh), so it does exist.

My problem now is to create an instance of this SFTP and here I get a compileerror that says:
"'Tamir:: SharpSsh:: Sftp:: Sftp' : no appropriate default constructor available"

I cant figure out what I am doing wrong. I have written down all my attempts of how to write this line.

using namespace Tamir::SharpSsh;

Sftp^ client = gcnew Sftp();
Sftp* client = gcnew Sftp();
Sftp client = gcnew Sftp();
Sftp^ client = gcnew Sftp;

Edited by Lukezzz: n/a

7 Years
Discussion Span
Last Post by Banfa

The problem is not in how you are declaring client it is how you are doing the construction of the new object. The missing or empty parenthesis indicate that the default constructor of Sftp should be called but the compiler can not find a default cinstructor for that class. Presumably the class is defined with a constructor that require parameters. You must pass these parameters when creating the object

Sftp^ client = gcnew Sftp([b]<Construction Parameters Here>[/b]);
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.