简体   繁体   English

无法从 Github 安装 C++ 库

[英]Trouble installing C++ libraries from Github

I've used C++ for several courses in university but the libraries we used in these courses were quite simple to install.我在大学的几门课程中使用 C++,但我们在这些课程中使用的库安装起来非常简单。 When we came across libraries which required a bit more complex installation, our teachers always provided detailed instructions.当我们遇到需要更复杂安装的图书馆时,我们的老师总是提供详细的说明。

This time I'm doing a project on my own.这次我自己做一个项目。 I have downloaded libraries for my own projects in the past.我过去曾为自己的项目下载过库。 Sometimes the install was easier, sometimes I had to search for hours to do things most people here would do in 5 minutes.有时安装更容易,有时我不得不搜索几个小时来完成这里大多数人会在 5 分钟内完成的事情。

I did some studying to remember some stuff about the compiling process, what dynamic and static libraries are, etc. I feel I understand the most part but it didn't really help me with my efforts to install some libraries.我做了一些学习来记住一些关于编译过程的东西,动态库和 static 库是什么,等等。我觉得我理解了大部分,但它并没有真正帮助我安装一些库。 Some people in Github provide instructions for newbies like me, but others, understandably, don't. Github 中的一些人为像我这样的新手提供了说明,但可以理解的是,其他人则没有。

I'm saying a lot so I'll get to the point.我说了很多,所以我会进入正题。 I will provide links for the library I'm trying to install but in case I'm not allowed to, please let me know so I can rewrite this in a way that is allowed.我将提供我正在尝试安装的库的链接,但如果我不允许,请告诉我,以便我可以以允许的方式重写它。

I'm trying to install libccd so I can then install fcl .我正在尝试安装libccd这样我就可以安装fcl In the instructions 3 ways are mentioned:在说明中提到了 3 种方式:

  • Using Makefile使用 Makefile
  • Using autotools使用自动工具
  • Using Cmake使用 Cmake

In all 3 methods, I see specific commands like this:在所有 3 种方法中,我看到如下特定命令:

安装说明中构建命令的屏幕截图

First of all, where am I supposed to write these commands?首先,我应该在哪里写这些命令?

I don't even know how to search this.我什至不知道如何搜索这个。 So, I tried installing with methods I've previously used.因此,我尝试使用以前使用的方法进行安装。 Here are the steps I took:以下是我采取的步骤:

  • Downloaded the whole repository.下载了整个存储库。
  • Made a solution for Visual Studio with Cmake-gui (that's all I know how to do with Cmake,unfortunately it usually was enough so I never learnt more)使用 Cmake-gui 为 Visual Studio 制作了一个解决方案(这就是我所知道的如何使用 Cmake,不幸的是它通常就足够了所以我从来没有学到更多)
  • Compiled the code in Release mode, which should give me a lib file.在 Release 模式下编译代码,应该会给我一个 lib 文件。
  • Now,in my own project, I added the relevant include directories of the repository I downloaded and the library directory for the lib file which was produced.现在,在我自己的项目中,我添加了我下载的存储库的相关包含目录和生成的 lib 文件的库目录。

I'm not sure about my last step.我不确定我的最后一步。 I'm pretty sure if I did the installation as proposed in the link(and as required by fcl), I would have a new folder for the library including just an include folder and a lib folder.我很确定如果我按照链接中的建议进行安装(并且按照 fcl 的要求),我将为库创建一个新文件夹,其中仅包括一个包含文件夹和一个 lib 文件夹。 Now I'm just searching for the correct include files and the lib file in subfolders of subfolders hoping I include the right ones.现在我只是在子文件夹的子文件夹中搜索正确的包含文件和 lib 文件,希望我包含正确的文件。 I'm a bit lost.我有点迷路了。

I'd really like some general steps(if there are) to installing a library.我真的很喜欢安装库的一些一般步骤(如果有的话)。 I know each library has its own ways but I assume the general idea with Cmake or Makefile should be the same.我知道每个图书馆都有自己的方式,但我认为 Cmake 或 Makefile 的总体思路应该是相同的。 I have tried searching online but I didn't come across a good or detailed enough tutorial.我曾尝试在线搜索,但没有找到足够好的或详细的教程。 I really don't wanna waste any more days trying to install libraries and I don't want to end up asking here again.我真的不想再浪费时间尝试安装库,也不想在这里再次询问。

UPDATE:更新:

It looks like there is no standard way to install libraries.看起来没有安装库的标准方法。 Since I'm getting 'close votes' I'll include a specific question:由于我得到“接近的选票”,我将包括一个具体问题:

Are the steps I took correct?我采取的步骤是否正确? What should I do next?接下来我该怎么办?

I'm trying to install libccd so I can then install fcl.我正在尝试安装 libccd,这样我就可以安装 fcl。 In the instructions 3 ways are mentioned:在说明中提到了 3 种方式:

  • Using Makefile使用 Makefile
  • Using autotools使用自动工具
  • Using Cmake使用 Cmake

In all 3 methods, I see specific commands like this:在所有 3 种方法中,我看到如下特定命令:

安装说明中构建命令的屏幕截图

First of all, where am I supposed to write these commands?首先,我应该在哪里写这些命令?

These instructions are for a UNIX-like system.这些说明适用于类 UNIX 系统。 Makefiles, autotools... these are UNIX things. Makefiles、autotools...这些是 UNIX 种东西。 You'd typically write those build commands into a console window on something like Linux or a Mac.您通常会将这些构建命令写入控制台 window ,例如 Linux 或 Mac。

CMake is a bit more cross-platform. CMake 更跨平台一点。 You can find out how to invoke CMake on other SO questions .您可以了解如何在其他 SO 问题上调用 CMake。

You can get Makefiles and such to work on Windows, using projects like Cygwin and MSYS.可以使用 Cygwin 和 MSYS 等项目获得 Makefiles 等以在 Windows 上工作。 I'd generally recommend you avoid that unless you really need it.我通常建议您避免这样做,除非您确实需要它。

I'm not sure about my last step.我不确定我的最后一步。 I'm pretty sure if I did the installation as proposed in the link(and as required by fcl), I would have a new folder for the library including just an include folder and a lib folder.我很确定如果我按照链接中的建议进行安装(并且按照 fcl 的要求),我将为库创建一个新文件夹,其中仅包括一个包含文件夹和一个 lib 文件夹。 Now I'm just searching for the correct include files and the lib file in subfolders of subfolders hoping I include the right ones.现在我只是在子文件夹的子文件夹中搜索正确的包含文件和 lib 文件,希望我包含正确的文件。 I'm a bit lost.我有点迷路了。

This is where no "general" advice exists.这是不存在“一般”建议的地方。 Different authors put their output in different places.不同的作者将他们的 output 放在不同的地方。 If their instructions didn't include this information, you're already doing the right thing.如果他们的说明没有包含此信息,那么您已经在做正确的事情。 If you get really stuck, you can always just ask them .如果你真的卡住了,你可以随时问他们

I'd really like some general steps(if there are) to installing a library.我真的很喜欢安装库的一些一般步骤(如果有的话)。

No such thing exists, but where these industry-standard tools are involved, you can usually go on general documentation for those tools, or from memory.不存在这样的东西,但在涉及这些行业标准工具的地方,您通常可以通过 go 了解这些工具的一般文档,或从 memory 获得。

I also suggest you shop around for a general book on programming, as general principles should be covered in any good one of those.我还建议您四处寻找一本关于编程的通用书籍,因为任何一本好的书籍都应该涵盖通用原则。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM