YOLOv5-LibTorch icon indicating copy to clipboard operation
YOLOv5-LibTorch copied to clipboard

Opencv Error when running make

Open vineeth2309 opened this issue 4 years ago • 2 comments

When i run make, it returns a linking error.

/usr/bin/ld: CMakeFiles/YOLOv5LibTorch.dir/src/YOLOv5LibTorch.cpp.o: in function main': YOLOv5LibTorch.cpp:(.text.startup+0xed7): undefined reference to cv::putText(cv::InputOutputArray const&, std::string const&, cv::Point, int, double, cv::Scalar_, int, int, bool)' /usr/bin/ld: YOLOv5LibTorch.cpp:(.text.startup+0xf5a): undefined reference to cv::imshow(std::string const&, cv::_InputArray const&)' /usr/bin/ld: YOLOv5LibTorch.cpp:(.text.startup+0x1621): undefined reference to cv::format(char const*, ...)' /usr/bin/ld: YOLOv5LibTorch.cpp:(.text.startup+0x16f6): undefined reference to `cv::putText(cv::InputOutputArray const&, std::string const&, cv::Point, int, double, cv::Scalar_, int, int, bool)' collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/YOLOv5LibTorch.dir/build.make:160: ../bin/YOLOv5LibTorch] Error 1 make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/YOLOv5LibTorch.dir/all] Error 2 make: *** [Makefile:103: all] Error 2

vineeth2309 avatar Jan 13 '21 06:01 vineeth2309

If you haven't figured it out since then, there might be some solutions that might help you. I have encountered similar problems

  1. Don't download that libtorch that is recomended in Readme. That was the first thing that was not working for me.
  1. Second thing, check your OpenCV version if it meets your expectations, I included several times opencv instead of e.g. opencv4, but this might not be the case.

lotricekCZ avatar Feb 24 '21 19:02 lotricekCZ

@lotricekCZ thanks! I changed the original libtorch with that you provided.Problem solved.

Nineteener avatar Apr 22 '21 11:04 Nineteener