Undefined Reference to Process(Std::_Cxx11::Basic_String ... ) When Compiling Affdex Linux Sample Applications

Undefined reference to process(std::__cxx11::basic_string ... ) when compiling affdex linux sample applications

My initial suspicion was that the problem is attempting to compile the apps using a newer GCC or rather GLIBCXX than what the sdk is compiled with (gcc v4.8).

The error msg refers to an undefined function that the compiler is unable to find ..

undefined reference to `affdex::VideoDetector::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)

The problem here is actually the type definition of the parameter (an std::string) .. the compiler is looking for:

std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >

But, the actual definition type of parameter in the compiled library is..

std::basic_string<char, std::char_traits<char>, std::allocator<char> >

As it turns out, GCC 5 introduced new implementations of std::string and std::list. You can try the workaround here to see if you can get the linking process to complete successfully, but the safest option is to fall back to using GCC 4.8.

Note, GCC 4.8 can be retrieved from ubuntu repos ..

Converting std::__cxx11::string to std::string

Is it possible that you are using GCC 5?

If you get linker errors about undefined references to symbols that involve types in the std::__cxx11 namespace or the tag [abi:cxx11] then it probably indicates that you are trying to link together object files that were compiled with different values for the _GLIBCXX_USE_CXX11_ABI macro. This commonly happens when linking to a third-party library that was compiled with an older version of GCC. If the third-party library cannot be rebuilt with the new ABI then you will need to recompile your code with the old ABI.

Source: GCC 5 Release Notes/Dual ABI

Defining the following macro before including any standard library headers should fix your problem: #define _GLIBCXX_USE_CXX11_ABI 0

Issues with compiling caffe with python, undefined reference to `std::__cxx11::....'

Following the official installation instruction with cmake solves this problem.

Steps to solution:

1. in your CAFFE/ directory run make clean
2. the follow in instruction of compile_caffe_with_cmake.

undefined reference to cv::ml with opencv_ml and opencv_objdetect

Ok, after serval times compiling and carefully consideration, I finally found what's wrong with my program.

The big problem is the link order. I just put ${OpenCV_LIBS} before ${PROJECT_NAME}. When I wrote:

target_link_libraries(Test ${PROJECT_NAME} ${OpenCV_LIBS})
target_link_libraries(Train ${PROJECT_NAME} ${OpenCV_LIBS})

Then All is well.



Related Topics



Leave a reply



Submit