source:
http://www.tamirgal.com/blog/page/SharpSSH.aspx

Hi,

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;

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]);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.