• undefined reference to...


    wj@wj-Inspiron-5437:~/Downloads/LBD_Descriptor/build$ cmake ..
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/wj/Downloads/LBD_Descriptor/build
    wj@wj-Inspiron-5437:~/Downloads/LBD_Descriptor/build$ make
    [ 66%] Built target LineMatchingLib
    Linking CXX executable TestLineMatchingAlgorithm
    CMakeFiles/TestLineMatchingAlgorithm.dir/TestLineMatchingAlgorithm.cpp.o: In function `cv::String::String(char const*)':
    TestLineMatchingAlgorithm.cpp:(.text._ZN2cv6StringC2EPKc[_ZN2cv6StringC5EPKc]+0x30): undefined reference to `cv::String::allocate(unsigned long)'
    CMakeFiles/TestLineMatchingAlgorithm.dir/TestLineMatchingAlgorithm.cpp.o: In function `cv::String::String(std::string const&)':
    TestLineMatchingAlgorithm.cpp:(.text._ZN2cv6StringC2ERKSs[_ZN2cv6StringC5ERKSs]+0x34): undefined reference to `cv::String::allocate(unsigned long)'
    CMakeFiles/TestLineMatchingAlgorithm.dir/TestLineMatchingAlgorithm.cpp.o: In function `main':
    TestLineMatchingAlgorithm.cpp:(.text.startup+0xfe): undefined reference to `cv::imread(cv::String const&, int)'
    TestLineMatchingAlgorithm.cpp:(.text.startup+0x12a): undefined reference to `cv::String::deallocate()'
    TestLineMatchingAlgorithm.cpp:(.text.startup+0x21e): undefined reference to `cv::imread(cv::String const&, int)'
    TestLineMatchingAlgorithm.cpp:(.text.startup+0x24a): undefined reference to `cv::String::deallocate()'
    TestLineMatchingAlgorithm.cpp:(.text.startup+0x624): undefined reference to `cv::line(cv::_InputOutputArray const&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)'
    TestLineMatchingAlgorithm.cpp:(.text.startup+0x7f3): undefined reference to `cv::line(cv::_InputOutputArray const&, cv::Point_<int>, cv::Point_<int>, cv::Scalar_<double> const&, int, int, int)'
    TestLineMatchingAlgorithm.cpp:(.text.startup+0x89d): undefined reference to `cv::imwrite(cv::String const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)'
    TestLineMatchingAlgorithm.cpp:(.text.startup+0x8a5): undefined reference to `cv::String::deallocate()'
    TestLineMatchingAlgorithm.cpp:(.text.startup+0x939): undefined reference to `cv::imwrite(cv::String const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)'
    TestLineMatchingAlgorithm.cpp:(.text.startup+0x941): undefined reference to `cv::String::deallocate()'
    TestLineMatchingAlgorithm.cpp:(.text.startup+0xa96): undefined reference to `cv::String::deallocate()'
    TestLineMatchingAlgorithm.cpp:(.text.startup+0xac9): undefined reference to `cv::String::deallocate()'
    TestLineMatchingAlgorithm.cpp:(.text.startup+0xb53): undefined reference to `cv::String::deallocate()'
    TestLineMatchingAlgorithm.cpp:(.text.startup+0xb96): undefined reference to `cv::String::deallocate()'
    libLineMatchingLib.so: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
    libLineMatchingLib.so: undefined reference to `cv::write(cv::FileStorage&, cv::String const&, cv::Mat const&)'
    libLineMatchingLib.so: undefined reference to `cv::FileStorage::FileStorage(cv::String const&, int, cv::String const&)'
    libLineMatchingLib.so: undefined reference to `cv::operator<<(cv::FileStorage&, cv::String const&)'
    collect2: error: ld returned 1 exit status
    make[2]: *** [TestLineMatchingAlgorithm] Error 1
    make[1]: *** [CMakeFiles/TestLineMatchingAlgorithm.dir/all] Error 2
    make: *** [all] Error 2

    阅读错误之后,感觉是没有找到opencv,搜了相关问题,然后修改了CMakeList.txt,解决了此问题。

    PROJECT(LILIANTESTS)
    cmake_minimum_required(VERSION 2.8)
    find_package( OpenCV REQUIRED ) //这两句可以连接到opencv
    add_executable( camera camera.cpp )
    target_link_libraries( camera ${OpenCV_LIBS} )
  • 相关阅读:
    这是一个数学题牛客训练赛E
    最好使用%f输出浮点数据,acm
    hdu 1263 水果 结构的排序+sort自定义排序
    多校寒训TaoTao要吃鸡dp
    计算直角坐标系的面积并和面积交和周长并(可小数)
    Codeforces Round #620 (Div. 2)E LCA
    Codeforces Round #620 (Div. 2)D dilworld定理
    Codeforces Round #621 (Div. 1 + Div. 2)D dij(思维)
    poj2243 给出m个模式串,求长度小于n的且存在模式串的字符串数有多少个(a~z)(思维构造+ac自动机)
    poj2778 求构造长度为n的字符串不包含给定的m个字符串的个数(矩阵乘法+ac自动机)
  • 原文地址:https://www.cnblogs.com/Jessica-jie/p/7509460.html
Copyright © 2020-2023  润新知