karta0807913 / caffe-yolo-9000

caffe-yolo-9000
Other
48 stars 16 forks source link

Compile error #6

Open zouhongwei opened 6 years ago

zouhongwei commented 6 years ago

When I complie caffe, I get some error, the output information is list bellow! Can you help me?

####################################################################### In file included from /usr/include/c++/4.8/algorithm:62:0, from /home/zouhongwei/workspce/caffe-yolo-9000/include/caffe/blob.hpp:4, from /home/zouhongwei/workspce/caffe-yolo-9000/include/caffe/caffe.hpp:7, from /home/zouhongwei/workspce/caffe-yolo-9000/examples/yolo_9000_test/netforward.cpp:1: /usr/include/c++/4.8/bits/stl_algo.h: In instantiation of ‘_RandomAccessIterator std::unguarded_partition(_RandomAccessIterator, _Ra ndomAccessIterator, const _Tp&) [with _RandomAccessIterator = yolo_v2::DATA*; _Tp = yolo_v2::DATA]’: /usr/include/c++/4.8/bits/stl_algo.h:2283:70: required from ‘_RandomAccessIterator std::unguarded_partition_pivot(_RandomAccessIte rator, _RandomAccessIterator) [with _RandomAccessIterator = yolo_v2::DATA]’ /usr/include/c++/4.8/bits/stl_algo.h:2315:54: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator , _Size) [with _RandomAccessIterator = yolo_v2::DATA; _Size = long int]’ /usr/include/c++/4.8/bits/stl_algo.h:5461:36: required from ‘void std::sort(_RAIter, _RAIter) [with _RAIter = yolo_v2::DATA]’ /home/zouhongwei/workspce/caffe-yolo-9000/examples/yolo_9000_test/yolo_v2_output.h:97:51: required from ‘std::vector yolo_v2::getResult(std::vector&, std::vector&, int, float, float) [with int OBJECTNUM = 5; int SIDE_ = 13]’ /home/zouhongwei/workspce/caffe-yolo-9000/examples/yolo_9000_test/netforward.cpp:86:86: required from here /usr/include/c++/4.8/bits/stl_algo.h:2245:19: error: passing ‘const yolo_v2::DATA’ as ‘this’ argument of ‘bool yolo_v2::DATA::operator <(yolo_v2::DATA)’ discards qualifiers [-fpermissive] while (__pivot < __last) ^ make[2]: [examples/CMakeFiles/netforward.dir/yolo_9000_test/netforward.cpp.o] Error 1 make[1]: [examples/CMakeFiles/netforward.dir/all] Error 2 make: *** [all] Error 2

######################################################################

karta0807913 commented 6 years ago

umm.. that is interesting can you change caffe-yolo-9000/examples/yolo_9000_test/yolo_v2_output.h:21

bool operator<(DATA data) to bool operator<(const DATA &data)

and try again?

zouhongwei commented 6 years ago

I tried it, but it does not work!

karta0807913 commented 6 years ago

got the same error?

zouhongwei commented 6 years ago

yes, the same error!

karta0807913 commented 6 years ago

On my ubuntu is ok use g++ g++ (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 i think you need to update your g++ to 5 or upper

myname:/usr/include/c++$ ls
4.9/  4.9.3/  5/  5.4.0/
TheNerd-alexis commented 6 years ago

I had same problem, but I solved by changing caffe-yolo-9000/examples/yolo_9000_test/yolo_v2_output.h:21

bool operator<(DATA data) to bool operator<(const DATA &data) const

I hope it will help you