gpt4 book ai didi

c++ - 使用 C++ 设置 OpenALPR, undefined reference 。

转载 作者:太空宇宙 更新时间:2023-11-04 12:57:08 25 4
gpt4 key购买 nike

我需要将 OpenALPR 库集成到我的 C++ 程序中。不幸的是,我无法进行链接工作。

openalpr.lib 在 C:\path\to\alpr 中,alpr.h 头文件在 C:\path\to\alpr\include all *.dll文件在 main 文件的目录中。系统Windows7,编译器Gcc 5.3。

当前构建命令:

g++ -Wall -fexceptions -g -IC:\path\to\alpr\include -c C:\path\to\project\main.cpp -o obj\main.o

g++ -LC:\path\to\alpr -o bin\test.exe obj\main.o -lopenalpr

代码:

#include <alpr.h>
int main()
{
alpr::Alpr openalpr("us", "openalpr.conf");
return 0;
}

错误:

undefined reference to `alpr::Alpr::Alpr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'

等等,还有很多类似的“ undefined reference ”。

OpenALPR 库以二进制版本下载自: https://github.com/openalpr/openalpr/wiki/Compilation-instructions-(Windows)

我应该从源代码构建库吗?也许我错过了什么?提前致谢。

最佳答案

GCC5 and the C++11 ABI :

Users that depend on third-party libraries or plugin interfaces that still use the old ABI can build their code with -D_GLIBCXX_USE_CXX11_ABI=0 and everything should work fine. In most cases, it will be obvious when this flag is needed because of errors from the linker complaining about unresolved symbols involving __cxx11.

尝试使用 -D_GLIBCXX_USE_CXX11_ABI=0 进行编译。

关于c++ - 使用 C++ 设置 OpenALPR, undefined reference 。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46036523/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com