dorian3d / DBoW2

Enhanced hierarchical bag-of-word library for C++
Other
866 stars 370 forks source link

Linking error while making v1.0 #40

Open kunalchelani opened 6 years ago

kunalchelani commented 6 years ago

Hi

I have OpenCV v2.4.11 installed which works fine with other applications. I have installed DLib v1.0. While making DBoW2-v1.0, I get the following error trace while linking the executable demo :

[100%] Linking CXX executable demo
CMakeFiles/demo.dir/demo/demo.cpp.o: In function `cv::operator<<(cv::FileStorage&, char const*)':
demo.cpp:(.text+0x52): undefined reference to `cv::operator<<(cv::FileStorage&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/demo.dir/demo/demo.cpp.o: In function `loadFeatures(std::vector<std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >, std::allocator<std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > > >&)':
demo.cpp:(.text+0x5ca): undefined reference to `cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
CMakeFiles/demo.dir/demo/demo.cpp.o: In function `cv::FileStorage& cv::operator<< <int>(cv::FileStorage&, int const&)':
demo.cpp:(.text+0x131a): undefined reference to `cv::Exception::Exception(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
demo.cpp:(.text+0x13b8): undefined reference to `cv::write(cv::FileStorage&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
CMakeFiles/demo.dir/demo/demo.cpp.o: In function `cv::FileStorage& cv::operator<< <DBoW2::ScoringType>(cv::FileStorage&, DBoW2::ScoringType const&)':
demo.cpp:(.text+0x15ac): undefined reference to `cv::Exception::Exception(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
demo.cpp:(.text+0x164c): undefined reference to `cv::write(cv::FileStorage&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
CMakeFiles/demo.dir/demo/demo.cpp.o: In function `cv::FileStorage& cv::operator<< <DBoW2::WeightingType>(cv::FileStorage&, DBoW2::WeightingType const&)':
demo.cpp:(.text+0x1840): undefined reference to `cv::Exception::Exception(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
demo.cpp:(.text+0x18e0): undefined reference to `cv::write(cv::FileStorage&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
CMakeFiles/demo.dir/demo/demo.cpp.o: In function `cv::FileStorage& cv::operator<< <double>(cv::FileStorage&, double const&)':
demo.cpp:(.text+0x1ad4): undefined reference to `cv::Exception::Exception(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
demo.cpp:(.text+0x1b82): undefined reference to `cv::write(cv::FileStorage&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double)'
CMakeFiles/demo.dir/demo/demo.cpp.o: In function `cv::FileStorage& cv::operator<< <std::vector<int, std::allocator<int> > >(cv::FileStorage&, std::vector<int, std::allocator<int> > const&)':
demo.cpp:(.text+0x1d76): undefined reference to `cv::Exception::Exception(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
CMakeFiles/demo.dir/demo/demo.cpp.o: In function `void cv::write<int>(cv::FileStorage&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<int, std::allocator<int> > const&)':
demo.cpp:(.text+0x1f3a): undefined reference to `cv::WriteStructContext::WriteStructContext(cv::FileStorage&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/demo.dir/demo/demo.cpp.o: In function `DBoW2::TemplatedVocabulary<std::vector<float, std::allocator<float> >, DBoW2::FSurf64>::save(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const':
demo.cpp:(.text._ZNK5DBoW219TemplatedVocabularyISt6vectorIfSaIfEENS_7FSurf64EE4saveERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZNK5DBoW219TemplatedVocabularyISt6vectorIfSaIfEENS_7FSurf64EE4saveERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x92): undefined reference to `cv::FileStorage::FileStorage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/demo.dir/demo/demo.cpp.o: In function `DBoW2::TemplatedDatabase<std::vector<float, std::allocator<float> >, DBoW2::FSurf64>::save(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const':
demo.cpp:(.text._ZNK5DBoW217TemplatedDatabaseISt6vectorIfSaIfEENS_7FSurf64EE4saveERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZNK5DBoW217TemplatedDatabaseISt6vectorIfSaIfEENS_7FSurf64EE4saveERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x92): undefined reference to `cv::FileStorage::FileStorage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/demo.dir/demo/demo.cpp.o: In function `DBoW2::TemplatedVocabulary<std::vector<float, std::allocator<float> >, DBoW2::FSurf64>::save(cv::FileStorage&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const':
demo.cpp:(.text._ZNK5DBoW219TemplatedVocabularyISt6vectorIfSaIfEENS_7FSurf64EE4saveERN2cv11FileStorageERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZNK5DBoW219TemplatedVocabularyISt6vectorIfSaIfEENS_7FSurf64EE4saveERN2cv11FileStorageERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x45): undefined reference to `cv::operator<<(cv::FileStorage&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
demo.cpp:(.text._ZNK5DBoW219TemplatedVocabularyISt6vectorIfSaIfEENS_7FSurf64EE4saveERN2cv11FileStorageERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZNK5DBoW219TemplatedVocabularyISt6vectorIfSaIfEENS_7FSurf64EE4saveERN2cv11FileStorageERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x372): undefined reference to `cv::operator<<(cv::FileStorage&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/demo.dir/demo/demo.cpp.o: In function `DBoW2::TemplatedVocabulary<std::vector<float, std::allocator<float> >, DBoW2::FSurf64>::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
demo.cpp:(.text._ZN5DBoW219TemplatedVocabularyISt6vectorIfSaIfEENS_7FSurf64EE4loadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN5DBoW219TemplatedVocabularyISt6vectorIfSaIfEENS_7FSurf64EE4loadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x92): undefined reference to `cv::FileStorage::FileStorage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/demo.dir/demo/demo.cpp.o: In function `DBoW2::TemplatedDatabase<std::vector<float, std::allocator<float> >, DBoW2::FSurf64>::save(cv::FileStorage&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const':
demo.cpp:(.text._ZNK5DBoW217TemplatedDatabaseISt6vectorIfSaIfEENS_7FSurf64EE4saveERN2cv11FileStorageERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZNK5DBoW217TemplatedDatabaseISt6vectorIfSaIfEENS_7FSurf64EE4saveERN2cv11FileStorageERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0xb1): undefined reference to `cv::operator<<(cv::FileStorage&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/demo.dir/demo/demo.cpp.o: In function `DBoW2::TemplatedDatabase<std::vector<float, std::allocator<float> >, DBoW2::FSurf64>::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
demo.cpp:(.text._ZN5DBoW217TemplatedDatabaseISt6vectorIfSaIfEENS_7FSurf64EE4loadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN5DBoW217TemplatedDatabaseISt6vectorIfSaIfEENS_7FSurf64EE4loadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x92): undefined reference to `cv::FileStorage::FileStorage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/demo.dir/demo/demo.cpp.o: In function `DBoW2::TemplatedVocabulary<std::vector<float, std::allocator<float> >, DBoW2::FSurf64>::load(cv::FileStorage const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
demo.cpp:(.text._ZN5DBoW219TemplatedVocabularyISt6vectorIfSaIfEENS_7FSurf64EE4loadERKN2cv11FileStorageERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN5DBoW219TemplatedVocabularyISt6vectorIfSaIfEENS_7FSurf64EE4loadERKN2cv11FileStorageERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x72): undefined reference to `cv::FileStorage::operator[](std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
CMakeFiles/demo.dir/demo/demo.cpp.o: In function `DBoW2::TemplatedDatabase<std::vector<float, std::allocator<float> >, DBoW2::FSurf64>::load(cv::FileStorage const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
demo.cpp:(.text._ZN5DBoW217TemplatedDatabaseISt6vectorIfSaIfEENS_7FSurf64EE4loadERKN2cv11FileStorageERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN5DBoW217TemplatedDatabaseISt6vectorIfSaIfEENS_7FSurf64EE4loadERKN2cv11FileStorageERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x117): undefined reference to `cv::FileStorage::operator[](std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
CMakeFiles/demo.dir/demo/demo.cpp.o: In function `cv::VecWriterProxy<int, 1>::operator()(std::vector<int, std::allocator<int> > const&) const':
demo.cpp:(.text._ZNK2cv14VecWriterProxyIiLi1EEclERKSt6vectorIiSaIiEE[_ZNK2cv14VecWriterProxyIiLi1EEclERKSt6vectorIiSaIiEE]+0xc0): undefined reference to `cv::FileStorage::writeRaw(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned char const*, unsigned long)'
/usr/local/lib/libDLib.so: undefined reference to `cv::imshow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&)'
/usr/local/lib/libDLib.so: undefined reference to `cv::FileNodeIterator::readRaw(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned char*, unsigned long)'
/usr/local/lib/libDLib.so: undefined reference to `cv::getTextSize(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, double, int, int*)'
/usr/local/lib/libDLib.so: undefined reference to `cv::imwrite(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)'
/usr/local/lib/libDLib.so: undefined reference to `cv::setMouseCallback(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, void (*)(int, int, int, int, void*), void*)'
/usr/local/lib/libDLib.so: undefined reference to `cv::namedWindow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
/usr/local/lib/libDLib.so: undefined reference to `cv::destroyWindow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/local/lib/libDLib.so: undefined reference to `cv::putText(cv::Mat&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::Point_<int>, int, double, cv::Scalar_<double>, int, int, bool)'
/usr/local/lib/libDLib.so: undefined reference to `cv::write(cv::FileStorage&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> > const&)'
collect2: error: ld returned 1 exit status

Any help/leads are appreciated. Thanks in advance.

DigitalGabriele commented 5 years ago

In CMakeLists.txt line 50: instead of add_executable(demo demo/demo.cpp), I changed it to add_executable(demo_test demo/demo.cpp)

On line 51: instead of target_link_libraries(demo ${PROJECT_NAME} ${OpenCV_LIBS}) -> target_link_libraries(demo_test ${PROJECT_NAME} ${OpenCV_LIBS})