在 C++ Ubuntu 中安装 FTP 客户端(库)
Installing FTP Client (Library) in C++ Ubuntu
我在 GitHub 上找到了这个库 https://github.com/embeddedmz/ftpclient-cpp,但是如何在 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里的吗?卷曲中的那个?或者什么?
在尝试了两者(Gtest 和 Curl 中的 Cmake)之后,我仍然收到错误:“没有这样的文件或目录”,同时尝试 #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/lib
,将FTP
中的两个头文件复制到/usr/local/include
。
然后,您应该能够通过添加 -I/usr/local/include
标志和 link 通过添加 -L/usr/local/lib -lftpclient
.
来包含头文件
我在 GitHub 上找到了这个库 https://github.com/embeddedmz/ftpclient-cpp,但是如何在 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里的吗?卷曲中的那个?或者什么?
在尝试了两者(Gtest 和 Curl 中的 Cmake)之后,我仍然收到错误:“没有这样的文件或目录”,同时尝试 #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/lib
,将FTP
中的两个头文件复制到/usr/local/include
。
然后,您应该能够通过添加 -I/usr/local/include
标志和 link 通过添加 -L/usr/local/lib -lftpclient
.