Setting up OpenALPR with c++, undefined reference.

631 views Asked by At

I need to integrate OpenALPR library into my c++ program. Unfortunaltely, I can't make linking work.

openalpr.lib is in C:\path\to\alpr , alpr.h header in C:\path\to\alpr\include all *.dll files are in catalog with main file. System Windows7, Compiler Gcc 5.3.

Current build command:

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

code:

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

error:

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> >)'

And so on, and so on, plenty of similar 'undefined references'.

OpenALPR library is downloaded in binary version from: https://github.com/openalpr/openalpr/wiki/Compilation-instructions-(Windows)

Am I supposed to build library from sources? Maybe I missed something? Thanks in advance.

1

There are 1 answers

3
Maxim Egorushkin On

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.

Try compiling with -D_GLIBCXX_USE_CXX11_ABI=0.