linux 下安装opencv3.0在编译时出现的问题undefined reference to `parallel_pthreads_set_threads_num(int)'

来源:互联网 发布:足彩平局分析软件 编辑:程序博客网 时间:2024/05/23 02:00

来自:http://blog.csdn.net/lyk_ffl/article/details/47683549

错误如下:

Linking CXX executable ../../bin/opencv_perf_core

在编译opencv 3.0 gold时,编译到大约37%时,出现

../../lib/libopencv_core.so.3.0.0: undefined reference to `parallel_pthreads_set_threads_num(int)'
../../lib/libopencv_core.so.3.0.0: undefined reference to `parallel_pthreads_get_threads_num()'
../../lib/libopencv_core.so.3.0.0: undefined reference to `parallel_for_pthreads(cv::Range const&, cv::ParallelLoopBody const&, double)'等好几个错误,困扰了好久,经多次尝试和不懈的坚持下,终于在github上找到了解决方法,现分享如下:

修改modules/core/src/parallel.cpp,添加7处删除5处(+表示要添加,-表示要删除)

132    namespace cv
133    {
134        ParallelLoopBody::~ParallelLoopBody() {}
135    +#if defined HAVE_PTHREADS && HAVE_PTHREADS
136    +    void parallel_for_pthreads(const cv::Range& range, const cv::ParallelLoopBody& body, double nstripes);
137    +    size_t parallel_pthreads_get_threads_num();
138    +    void parallel_pthreads_set_threads_num(int num);
139    +#endif
140     }
141     
142    +
143    namespace
144    {
145    #ifdef CV_PARALLEL_FRAMEWORK
    .
    .
    .

307         }
308 
309    #elif defined HAVE_PTHREADS
    -        void parallel_for_pthreads(const Range& range, const ParallelLoopBody& body, double nstripes);
310    +
311             parallel_for_pthreads(range, body, nstripes);
312 
313     #else
    .
    .
    .

367 
368    #elif defined HAVE_PTHREADS
369 
    -        size_t parallel_pthreads_get_threads_num();
    -
370         return parallel_pthreads_get_threads_num();
371 
372    #else
.
.
.
428 
429    #elif defined HAVE_PTHREADS
430 
    -    void parallel_pthreads_set_threads_num(int num);    
    -
431     parallel_pthreads_set_threads_num(threads);
432 

433    #endif


要是看的不方便的话,原始链接如下:

https://github.com/mshabunin/opencv/commit/1f983ec39c97298b0c8ce409a1cc229ecf14e55c?diff=unified


0 0
原创粉丝点击