【问题标题】:C++/OpenFST - Error on Finding Library and LinkingC++/OpenFST - 查找库和链接时出错
【发布时间】:2018-06-21 11:04:32
【问题描述】:

在 OpenFST web site 中是这样说的;

OpenFst 库是一个 C++ 模板库。在 C++ 中,在安装包含目录中包含并链接到安装库目录中的 libfst.so。

为了简单起见,我的代码只包含这个;

#include <fst/fstlib.h>
#include <iostream>
int main(){
}

我在 /home/me/usr/include/fst 下有 fstlib.h,在 /home 下有 libfst.so /me/usr/lib.我试过这个;

$g++ -I/home/me/usr/include/ code.cpp -lfst -L/home/me/usr/lib

基于this solution。

但是,我遇到了很多关于找不到库的错误。喜欢this。

你对它有什么建议?谢谢。

【问题讨论】:

  • 你能在你的 code.cpp 中提供包含吗?
  • 我做到了。 @aicastell
  • 请把错误信息放在你的问题中。
  • 我确实将错误消息作为图像。我不能把它完全说出来,因为它甚至超过了外壳。 @RogerLipscombe

标签: c++ linux shell openfst


【解决方案1】:

尝试将 -std=gnu++11 添加到您的编译行:

$g++ -std=gnu++11 -I/home/me/usr/include/ code.cpp -lfst -L/home/me/usr/lib

如果您总是遇到类似问题,请查找编译时出现在日志中的第一条错误消息。

希望这会有所帮助! :-)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-05-09
    • 2020-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-22
    相关资源
    最近更新 更多