c++ - 在 C++ Ubuntu 中安装 FTP 客户端(库)

标签 c++ ubuntu cmake

我找到了这个库 https://github.com/embeddedmz/ftpclient-cpp在 GitHub 上,但如何在 Linux(Ubuntu) 上安装它却非常晦涩难懂。

You will need CMake to generate a makefile for the static library or to build the tests/code coverage program. Also make sure you have libcurl and Google Test installed.

You can follow this script https://gist.github.com/fideloper/f72997d2e2c9fbe66459 to install libcurl.

This tutorial will help you installing properly Google Test on Ubuntu: https://www.eriksmistad.no/getting-started-with-google-test-on-ubuntu/

The CMake script located in the tree will produce Makefiles for the creation of the static library and for the unit tests program.

To create a debug static library and a test binary, change directory to the one containing the first CMakeLists.txt and :

mkdir build    
cd build    
cmake .. -DCMAKE_BUILD_TYPE:STRING=Debug
make
我不清楚“包含第一个 CMakeLists.txt 的那个”指的是什么。它是Gtest中的那个吗? curl 的那个?或者是什么?
在尝试了这两种方法(Gtest 和 Curl 中的 Cmake)之后,我仍然收到错误消息:“No such file or directory”,同时尝试 #include "FTPClient.h"。
更新:
列出我在做什么:
我做了git clone https://github.com/embeddedmz/ftpclient-cpp.git然后创建构建文件夹,导航到它,我尝试了 cmake .. -DCMAKE_BUILD_TYPE:STRING=Debug (这是我插入的文字命令),我得到

Cmake Error at CmakeLists.txt: 27 (add_subdirectory): add_subdirectory given source "TestFTP" which is not an existing directory


那么到目前为止有什么问题?

最佳答案

建库后会有libftpclient.a在您的构建树中生成。
您可以按如下方式将其安装到您的系统中:
在这种情况下,复制 libftpclient.a/usr/local/libFTP 中的两个头文件至/usr/local/include .
然后您应该能够通过添加 -I/usr/local/include 来包含头文件。通过添加 -L/usr/local/lib -lftpclient 标记和链接.

关于c++ - 在 C++ Ubuntu 中安装 FTP 客户端(库),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68937369/

相关文章:

Java app通过JNI调用C++ DLL;如何最好地分配内存?

performance - Ubuntu 性能监控工具,例如 PerfMon

magento - SOAP 错误 : Parsing Schema: can't import schema from …

c++ - 如何在CMake中手动链接SDL2

c - 在Linux上编译OpenCL ICD加载器时出错

c++ - QNetworkAccessManager 即使在另一个线程中也会卡住 GUI

c++ - cucumber CPP 构建错误 : is_initialized() is not a member of unit test

c++ - Windows 堆管理器 - 前端和后端分配器

linux - 将只读驱动器安装为写入驱动器

c++ - 从 Cmake 创建 Xcode 项目包含不需要的编译器标志