I have downloaded the ftp library files from http://www.example-code.com/vcpp/ftp_passiveUpload.asp
And set it in my code:
#include "stdafx.h"
#include "iostream"
#include <CkFtp2.h>
void ChilkatSample(void)
int main(){
ChilkatSample();
return 0;
}
void ChilkatSample(void)
{
CkFtp2 ftp;
bool success;
// Any string unlocks the component for the 1st 30-days.
success = ftp.UnlockComponent("Anything for 30-day trial");
if (success != true) {
printf("%s\n",ftp.lastErrorText());
return;
}
ftp.put_Hostname("www.example-code.com");
ftp.put_Username("***");
ftp.put_Password("***");
// Use Passive mode.
ftp.put_Passive(true);
// Connect and login to the FTP server.
success = ftp.Connect();
if (success != true) {
printf("%s\n",ftp.lastErrorText());
return;
}
// Change to the remote directory where the file will be uploaded.
success = ftp.ChangeRemoteDir("junk");
if (success != true) {
printf("%s\n",ftp.lastErrorText());
return;
}
// Upload a file.
const char * localFilename; //The local file exists already
localFilename = "hamlet.xml";
const char * remoteFilename;
remoteFilename = "hamlet.xml";
success = ftp.PutFile(localFilename,remoteFilename);
if (success != true) {
printf("%s\n",ftp.lastErrorText());
return;
}
ftp.Disconnect();
printf("File Uploaded!\n");
}
But when i compile the program it give the error:
error LNK2019: unresolved external symbol "public: void __thiscall CkFtp2::put_Username(char const *)" (?put_Username@CkFtp2@@QAEXPBD@Z) referenced in function "void __cdecl ChilkatSample(void)" (?ChilkatSample@@YAXXZ)