Issue
I have found this library https://github.com/embeddedmz/ftpclient-cpp on GitHub but how to install it on Linux(Ubuntu) is quite obscure.
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
It is not clear to me what "to the one containing the first CMakeLists.txt" refers to. Is it the one in the Gtest? The one in Curl? Or What?
After trying both (the Cmake in Gtest and Curl) I still get the error: "No such file or directory" while trying to #include "FTPClient.h" .
UPDATE:
Listing what I am doing:
I did git clone https://github.com/embeddedmz/ftpclient-cpp.git
then made the build folder, navigate into it, I tried cmake .. -DCMAKE_BUILD_TYPE:STRING=Debug
(this is the literal command I inserted) and I get
Cmake Error at CmakeLists.txt: 27 (add_subdirectory): add_subdirectory given source "TestFTP" which is not an existing directory
So what is wrong so far?
Solution
After you build the library, there will be a libftpclient.a
generated in your build tree.
You can install it to your system as follows:
In this case, copy libftpclient.a
to /usr/local/lib
and the two header files in FTP
to /usr/local/include
.
You should then be able to include the header files by adding the -I/usr/local/include
flag and link by adding -L/usr/local/lib -lftpclient
.
Answered By - Botje Answer Checked By - Katrina (WPSolving Volunteer)