简体   繁体   English

在 Linux 上使用 C++ 库

[英]Using C++ Libraries on Linux

I'm trying to follow along here to use a speech recognition model.我在这里尝试使用语音识别 model。 The model is in C++, and almost all of my experience is in Python. model 在 C++ 中,我几乎所有的经验都在 Python 中。

I installed a virtual machine running Ubuntu, and still the installation procedure was failing for me.我安装了一台运行 Ubuntu 的虚拟机,但安装过程对我来说仍然失败。 I decided to simply try to compile the model so that I could call it in a Python script , as seen at the bottom of the linked page.我决定简单地尝试编译 model 以便我可以在 Python 脚本中调用它,如链接页面底部所示。

I'm trying to use g++ to compile the .cpp model, but I keep getting an error saying that a library that I have installed is not found:我正在尝试使用 g++ 来编译.cpp model,但我一直收到错误消息,提示找不到我已安装的库:

name@name-virtual-machine:~/Documents/<PATH_TO_FILE>$ g++ InteractiveStreamingASRExample.cpp 
In file included from InteractiveStreamingASRExample.cpp:70:
cereal/archives/binary.hpp:43:10: fatal error: cereal/macros.hpp: No such file or directory
   43 | #include <cereal/macros.hpp>
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.

I tried simply putting the file in my directory and using parentheses rather than angled brackets, but this caused further issues down the line.我尝试简单地将文件放在我的目录中并使用括号而不是尖括号,但这会导致进一步的问题。

My bin folder contains a "cereal.bin" file, but no "cereal" folder.我的 bin 文件夹包含一个“cereal.bin”文件,但没有“cereal”文件夹。

Does anyone know how to resolve this issue?有谁知道如何解决这个问题? It would be much appreciated - I've been trying to get this working for a day将不胜感激 - 我一直在努力让它工作一天

You've installed only the runtime libraries.您只安装了运行时库。 You also have to install the development version (eg header files), most likely called something like cereal-devel or so.您还必须安装开发版本(例如 header 文件),最有可能称为像谷物开发这样的东西。

Alan Birtles provided a link to the development packages in the comments section above. Alan Birtles 在上面的评论部分提供了开发包的链接。

https://packages.ubuntu.com/focal/libcereal-dev https://packages.ubuntu.com/focal/libcereal-dev

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

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