I am new to the Raspberry Pi and opencv lib, I have spent some time learning opencv up until I finished my first program written in c++ .

Now I want to compile and execute the same c++ file on the Pi , but I get errors, mostly "undefined references". I know I installed Opencv correctly because I have run some of the sample codes successfully.

My question is. Can I simply copy the code I have written on the Pi and execute it there? Or what else do I need to do before to make that possible?

1 Answer 1


Try using cmake. From OpenCV's website, it is recommended that you use cmake to compile it. Refer to http://docs.opencv.org/2.4/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.html

  • One sentence plus a link does not count as an answer, you need to give a thorough explanation as to why your solution works. As well as different ways of approaching the problem, one solution does not work for all.
    – Darth Vader
    Apr 2, 2016 at 11:37
  • it actually helped , i tought i would do a whole linkage process all over again , thank you very much Apr 8, 2016 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.