Это - ошибка, которую я получаю при компиляции моей программы с библиотекой Chilkat. Я понимаю, что должен включать "-l", но когда я включаю это, он дает мне это:
/usr/bin/ld: cannot find -lchilkat-9.5.0
collect2: error: ld returned 1 exit status
Я загрузил Библиотеку C/C++ Chilkat отсюда. Я действительно не знаю, как использовать.a или .so для компиляции моего .cpp файла.
Это - мой исходный код. Библиотеки хранятся в каталоге, который я включал.
#include <iostream>
#include "chilkat/include/CkFtp2.h"
using namespace std;
int main(){
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) {
std::cout << ftp.lastErrorText() << "\r\n";
return 0;
}
ftp.put_Hostname("ftp.someFtpServer.com");
ftp.put_Username("****");
ftp.put_Password("****");
// Connect and login to the FTP server.
success = ftp.Connect();
if (success != true) {
std::cout << ftp.lastErrorText() << "\r\n";
return 0;
}
// Change to the remote directory where the file will be uploaded.
success = ftp.ChangeRemoteDir("junk");
if (success != true) {
std::cout << ftp.lastErrorText() << "\r\n";
return 0;
}
// Upload a file.
const char *localFilename = "c:/temp/hamlet.xml";
const char *remoteFilename = "hamlet.xml";
success = ftp.PutFile(localFilename,remoteFilename);
if (success != true) {
std::cout << ftp.lastErrorText() << "\r\n";
return 0;
}
success = ftp.Disconnect();
std::cout << "File Uploaded!" << "\r\n";
return 0;
}
Мне удалось скомпилировать Вашу программу со следующим:
g++ test.cpp -Lchilkat/lib -lchilkat-9.5.0 -o test
- L дает путь, где библиотека хранится
- l дает название библиотеки