我需要将OpenALPR库集成到我的c++程序中。不幸的是,我无法使链接工作。
openalpr.lib位于C:\path\to\alpr中,alpr.h头中的C:\path\to\alpr\包含所有*.dll文件都在主文件目录中。系统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> >)'等等,很多类似的“未定义的引用”。
OpenALPR库以二进制版本从:https://github.com/openalpr/openalpr/wiki/Compilation-instructions-(Windows)下载。
我应该从源头建立图书馆吗?也许我漏掉了什么?提前谢谢。
发布于 2017-09-04 12:40:18
依赖第三方库或插件接口的用户仍然使用旧的ABI,他们可以用
-D_GLIBCXX_USE_CXX11_ABI=0构建他们的代码,一切都应该很好。在大多数情况下,由于链接器的错误抱怨涉及__cxx11的未解决符号,需要使用此标志时非常明显。
尝试使用-D_GLIBCXX_USE_CXX11_ABI=0进行编译。
https://stackoverflow.com/questions/46036523
复制相似问题