Gå til innhold

Hjelp til å bruke chilkat-bibliotek i VSC++


Anbefalte innlegg

Hei!

 

Slik som jeg forstår det, er chilkat-biblioteket et typisk eksempel på hvordan et bibliotek ser ut i C++? Med include-mappe og lib-mappe?

 

Det jeg har gjort er at jeg har gått inn på:

Tools -> Options -> Projects and solutions -> VC++ Directories

 

Her har jeg under library files lagt til libs-mappa og under include files lagt til include-mappa.

 

Så tar vi en eksempel-kode som jeg finner på sida deres, for eksempel dette eksempelet:

 

#include <CkFtp2.h>
#include <CkString.h>

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("ftp.chilkatsoft.com");
ftp.put_Username("****");
ftp.put_Password("****");

//  The default data transfer mode is "Active" as opposed to "Passive".

//  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.
CkString localFilename;
localFilename = "hamlet.xml";
CkString remoteFilename;
remoteFilename = "hamlet.xml";

success = ftp.PutFile(localFilename,remoteFilename);
if (success != true) {
	printf("%s\n",ftp.lastErrorText());
	return;
}

ftp.Disconnect();

printf("File Uploaded!\n");
}

Da får jeg disse feilene:

1>------ Build started: Project: ftp-client, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>c:\users\arne\documents\visual studio 2008\projects\ftp-client\include\ckstring.h(92) : error C2061: syntax error : identifier 'SYSTEMTIME'
1>c:\users\arne\documents\visual studio 2008\projects\ftp-client\include\ckftp2.h(195) : error C2061: syntax error : identifier 'FILETIME'
1>c:\users\arne\documents\visual studio 2008\projects\ftp-client\include\ckftp2.h(196) : error C2061: syntax error : identifier 'FILETIME'
1>c:\users\arne\documents\visual studio 2008\projects\ftp-client\include\ckftp2.h(197) : error C2061: syntax error : identifier 'FILETIME'
1>c:\users\arne\documents\visual studio 2008\projects\ftp-client\include\ckftp2.h(199) : error C2061: syntax error : identifier 'SYSTEMTIME'
1>c:\users\arne\documents\visual studio 2008\projects\ftp-client\include\ckftp2.h(199) : error C2535: 'bool CkFtp2::GetCreateTime(long)' : member function already defined or declared
1>		c:\users\arne\documents\visual studio 2008\projects\ftp-client\include\ckftp2.h(195) : see declaration of 'CkFtp2::GetCreateTime'
1>c:\users\arne\documents\visual studio 2008\projects\ftp-client\include\ckftp2.h(200) : error C2061: syntax error : identifier 'SYSTEMTIME'
1>c:\users\arne\documents\visual studio 2008\projects\ftp-client\include\ckftp2.h(200) : error C2535: 'bool CkFtp2::GetLastAccessTime(long)' : member function already defined or declared
1>		c:\users\arne\documents\visual studio 2008\projects\ftp-client\include\ckftp2.h(196) : see declaration of 'CkFtp2::GetLastAccessTime'
1>c:\users\arne\documents\visual studio 2008\projects\ftp-client\include\ckftp2.h(201) : error C2061: syntax error : identifier 'SYSTEMTIME'
1>c:\users\arne\documents\visual studio 2008\projects\ftp-client\include\ckftp2.h(201) : error C2535: 'bool CkFtp2::GetLastModifiedTime(long)' : member function already defined or declared
1>		c:\users\arne\documents\visual studio 2008\projects\ftp-client\include\ckftp2.h(197) : see declaration of 'CkFtp2::GetLastModifiedTime'
1>c:\users\arne\documents\visual studio 2008\projects\ftp-client\include\ckftp2.h(363) : error C2061: syntax error : identifier 'SYSTEMTIME'
1>c:\users\arne\documents\visual studio 2008\projects\ftp-client\include\ckftp2.h(366) : error C2061: syntax error : identifier 'SYSTEMTIME'
1>c:\users\arne\documents\visual studio 2008\projects\ftp-client\include\ckftp2.h(369) : error C2061: syntax error : identifier 'SYSTEMTIME'
1>c:\users\arne\documents\visual studio 2008\projects\ftp-client\include\ckftp2.h(375) : error C2061: syntax error : identifier 'SYSTEMTIME'
1>c:\users\arne\documents\visual studio 2008\projects\ftp-client\include\ckftp2.h(385) : error C2061: syntax error : identifier 'SYSTEMTIME'
1>c:\users\arne\documents\visual studio 2008\projects\ftp-client\ftp-client\main.cpp(13) : error C3861: 'printf': identifier not found
1>c:\users\arne\documents\visual studio 2008\projects\ftp-client\ftp-client\main.cpp(26) : error C3861: 'printf': identifier not found
1>c:\users\arne\documents\visual studio 2008\projects\ftp-client\ftp-client\main.cpp(33) : error C3861: 'printf': identifier not found
1>c:\users\arne\documents\visual studio 2008\projects\ftp-client\ftp-client\main.cpp(45) : error C3861: 'printf': identifier not found
1>c:\users\arne\documents\visual studio 2008\projects\ftp-client\ftp-client\main.cpp(51) : error C3861: 'printf': identifier not found

 

Hva kan dette være?

 

Er printf C kanskje? Det funker uansett ikke med .c-filendelse!

Lenke til kommentar
Videoannonse
Annonse

Ja, nå gikk det. Inkluderte som følger i starten av dokumentet:

#include <stdio.h>
#include <time.h>
#include <windows.h>
#include <CkFtp2.h>
#include <CkString.h>

 

Men jeg får en linking-feil, nemlig at entry-point ikke er definert! Så jeg lager en main-funksjon og kaller denne chilkat-funksjonen jeg har laget, men da får jeg mange andre errors igjen:

Klikk for å se/fjerne innholdet nedenfor

1>main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall CkFtp2::Disconnect(void)" (?Disconnect@CkFtp2@@QAE_NXZ) referenced in function "void __cdecl ChilkatSample(void)" (?ChilkatSample@@YAXXZ)

1>main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall CkString::~CkString(void)" (??1CkString@@UAE@XZ) referenced in function "void __cdecl ChilkatSample(void)" (?ChilkatSample@@YAXXZ)

1>main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall CkFtp2::PutFile(char const *,char const *)" (?PutFile@CkFtp2@@QAE_NPBD0@Z) referenced in function "void __cdecl ChilkatSample(void)" (?ChilkatSample@@YAXXZ)

1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall CkString::operator char const *(void)" (??BCkString@@QAEPBDXZ) referenced in function "void __cdecl ChilkatSample(void)" (?ChilkatSample@@YAXXZ)

1>main.obj : error LNK2019: unresolved external symbol "public: class CkString & __thiscall CkString::operator=(char const *)" (??4CkString@@QAEAAV0@PBD@Z) referenced in function "void __cdecl ChilkatSample(void)" (?ChilkatSample@@YAXXZ)

1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall CkString::CkString(void)" (??0CkString@@QAE@XZ) referenced in function "void __cdecl ChilkatSample(void)" (?ChilkatSample@@YAXXZ)

1>main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall CkFtp2::ChangeRemoteDir(char const *)" (?ChangeRemoteDir@CkFtp2@@QAE_NPBD@Z) referenced in function "void __cdecl ChilkatSample(void)" (?ChilkatSample@@YAXXZ)

1>main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall CkFtp2::Connect(void)" (?Connect@CkFtp2@@QAE_NXZ) referenced in function "void __cdecl ChilkatSample(void)" (?ChilkatSample@@YAXXZ)

1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall CkFtp2::put_Password(char const *)" (?put_Password@CkFtp2@@QAEXPBD@Z) referenced in function "void __cdecl ChilkatSample(void)" (?ChilkatSample@@YAXXZ)

1>main.obj : 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)

1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall CkFtp2::put_Hostname(char const *)" (?put_Hostname@CkFtp2@@QAEXPBD@Z) referenced in function "void __cdecl ChilkatSample(void)" (?ChilkatSample@@YAXXZ)

1>main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall CkFtp2::~CkFtp2(void)" (??1CkFtp2@@UAE@XZ) referenced in function "void __cdecl ChilkatSample(void)" (?ChilkatSample@@YAXXZ)

1>main.obj : error LNK2019: unresolved external symbol "public: char const * __thiscall CkFtp2::lastErrorText(void)" (?lastErrorText@CkFtp2@@QAEPBDXZ) referenced in function "void __cdecl ChilkatSample(void)" (?ChilkatSample@@YAXXZ)

1>main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall CkFtp2::UnlockComponent(char const *)" (?UnlockComponent@CkFtp2@@QAE_NPBD@Z) referenced in function "void __cdecl ChilkatSample(void)" (?ChilkatSample@@YAXXZ)

1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall CkFtp2::CkFtp2(void)" (??0CkFtp2@@QAE@XZ) referenced in function "void __cdecl ChilkatSample(void)" (?ChilkatSample@@YAXXZ)

1>C:\Documents and Settings\arnhan\Mine dokumenter\Visual Studio 2008\Projects\calculator\Debug\calculator.exe : fatal error LNK1120: 15 unresolved externals

Lenke til kommentar

Som jeg skriver i førstepost, så har jeg:

Det jeg har gjort er at jeg har gått inn på:

Tools -> Options -> Projects and solutions -> VC++ Directories

 

Her har jeg under library files lagt til libs-mappa og under include files lagt til include-mappa.

 

Hvis det trengs å gjøre noe mer enn dette, så har jeg ikke det, nei.

Lenke til kommentar

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
  • Hvem er aktive   0 medlemmer

    • Ingen innloggede medlemmer aktive
×
×
  • Opprett ny...