【发布时间】:2021-10-26 10:43:10
【问题描述】:
我在 GitHub 上找到了这个库 https://github.com/embeddedmz/ftpclient-cpp,但如何在 Linux(Ubuntu) 上安装它却非常晦涩。
您将需要 CMake 为静态库生成 makefile 或 构建测试/代码覆盖程序。还要确保你有 已安装 libcurl 和 Google Test。
你可以按照这个脚本 https://gist.github.com/fideloper/f72997d2e2c9fbe66459 安装 libcurl.
本教程将帮助您在 Ubuntu 上正确安装 Google Test: https://www.eriksmistad.no/getting-started-with-google-test-on-ubuntu/
位于树中的 CMake 脚本将为 创建静态库和单元测试程序。
要创建调试静态库和测试二进制文件,请更改目录 到包含第一个 CMakeLists.txt 和的那个:
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE:STRING=Debug
make
我不清楚“包含第一个 CMakeLists.txt 的那个”指的是什么。它是Gtest中的那个吗?卷曲的那个?还是什么?
在尝试两个(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(这是我插入的文字命令),我得到了
CmakeLists.txt 中的 Cmake 错误:27 (add_subdirectory): add_subdirectory given source "TestFTP" which is not an existing directory
那么到目前为止有什么问题?
【问题讨论】:
-
项目的根目录。包含 .gitignore 和 .clang-format 的那个。
-
"我在尝试 #include "FTPClient.h"" 时仍然遇到错误" - 请显示(包括在问题帖子中)您正在使用的确切命令和您收到的确切错误消息。