这是在用Chilkat库编译我的程序时遇到的错误。我知道我需要包含"-l“,但是当我包含它时,它给了我以下内容:
/usr/bin/ld: cannot find -lchilkat-9.5.0
collect2: error: ld returned 1 exit status我从这里下载了Chilkat /C++库。我真的不知道如何使用.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;
}发布于 2018-09-23 10:03:46
我用以下方法编译了您的程序:
g++ test.cpp -Lchilkat/lib -lchilkat-9.5.0 -o test-L给出了存储库的路径
-l给出了库的名称
https://askubuntu.com/questions/1077535
复制相似问题