【问题标题】:How do I link to a library with g++?如何使用 g++ 链接到库?
【发布时间】:2018-07-21 21:49:31
【问题描述】:

我正在尝试使用 Open ALPR 编译一个小测试程序,如 https://github.com/openalpr/openalpr/wiki/Integrating-OpenALPR 中所述。 我想出了类似的东西:

#include <alpr.h>
#include <iostream>

int main (void) 
{
    alpr::Alpr openalpr("us", "/etc/openalpr/openalpr.conf");


    std::cout << "Hello World!" << std::endl;

    return 0;
}

但我无法编译它。我试过了: g++ -Wall -l /usr/lib/libopenalpr.so test.cpp -o test 但我明白了 /usr/bin/ld: cannot find -l/usr/lib/libopenalpr.so/usr/lib/libopenalpr.so 确实存在并链接到 libopenalpr.so.2,它也存在。链接到这个库的正确方法是什么?

【问题讨论】:

标签: compilation g++ shared-libraries


【解决方案1】:

答案可以在这里找到: unable to compile with library

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-02-23
    • 2023-03-09
    • 1970-01-01
    • 1970-01-01
    • 2023-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多