首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用Chilkat库编译C++程序

用Chilkat库编译C++程序
EN

Ask Ubuntu用户
提问于 2018-09-22 17:08:12
回答 1查看 750关注 0票数 0

是在用Chilkat库编译我的程序时遇到的错误。我知道我需要包含"-l“,但是当我包含它时,它给了我以下内容:

代码语言:javascript
复制
/usr/bin/ld: cannot find -lchilkat-9.5.0
collect2: error: ld returned 1 exit status

我从这里下载了Chilkat /C++库。我真的不知道如何使用.a或.so编译我的.cpp文件。

是我的源代码。库存储在我所包含的目录中。

代码语言:javascript
复制
#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;
}
EN

回答 1

Ask Ubuntu用户

回答已采纳

发布于 2018-09-23 10:03:46

我用以下方法编译了您的程序:

代码语言:javascript
复制
    g++ test.cpp -Lchilkat/lib -lchilkat-9.5.0 -o test

-L给出了存储库的路径

-l给出了库的名称

票数 3
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1077535

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档