我需要将OpenALPR库集成到我的C++程序中。不幸的是,我不能做链接工作。用C++,未定义的参考设置OpenALPR。
openalpr.lib是在C:\路径\到\ ALPR,alpr.h头在C:\路径\到\ 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> >)'
等等,等等,很多类似的 '未定义的引用' 的。 https://github.com/openalpr/openalpr/wiki/Compilation-instructions-(Windows)
我应该建立从资源库:
OpenALPR库中的二进制版本下载下来?也许我错过了什么?提前致谢。
'克++ -Wall -fexceptions -D_GLIBCXX_USE_CXX11_ABI = 0 -g -IC:\ ALPR \包括-c C:\项目\ main.cpp中-o OBJ \ main.o' 没什么改变。 – Rajju
@Rajju您是否尝试过使用该命令编译后尝试链接? –
是的,我删除.o文件,从头开始编译所有东西,然后再次链接(即使传递-D_GLIBCXX_USE_CXX11_ABI = 0作为链接器标志也是如此)。 – Rajju